-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Omar-Belghaouti/chore/new-proj-structure
Chore: New Project Structure
- Loading branch information
Showing
55 changed files
with
2,363 additions
and
1,401 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,64 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Node.js Package | ||
name: "🚀 publish" | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12 | ||
- run: npm ci | ||
- run: npm test | ||
|
||
publish-npm: | ||
needs: build | ||
name: 🚀 NPM publish | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
- name: ☄️ checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: 🐱🏍 node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
node-version: ${{ matrix.node-version }} | ||
registery-url: https://registry.npmjs.org/ | ||
|
||
- name: 📦 install dependencies | ||
run: npm install | ||
|
||
- name: 🐱👤 create .npmrc | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > .npmrc | ||
|
||
- name: 🚀 publish | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.npm_token}} | ||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} | ||
|
||
publish-gpr: | ||
needs: build | ||
name: 🚀 GPR publish | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [14.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: https://npm.pkg.github.com/ | ||
- run: npm ci | ||
- run: npm publish | ||
|
||
- name: 📦 install dependencies | ||
run: npm install | ||
|
||
- name: 🐱👤 create .npmrc | ||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NODE_AUTH_TOKEN }}" > .npmrc | ||
|
||
- name: 🐱🏍 prepare gpr | ||
run: node prepare-gpr.js | ||
|
||
- name: 🚀 publish | ||
run: npm publish --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const fs = require("file-system"); | ||
|
||
/** | ||
* @function combineComponents | ||
* @description this function is used to combine existed componets to a folder. | ||
* @param {Array} components - array of components to be combined. | ||
* @param {string} folder - folder path to contain the combined components. | ||
* @author [Omar Belghaouti](https://github.com/Omar-Belghaouti) | ||
*/ | ||
exports.combineComponents = (components, folder) => { | ||
const path = "src/components/"; | ||
const _path = `${path}${folder}/`; | ||
let folders = []; | ||
components.forEach((component) => { | ||
fs.readdirSync(path) | ||
.filter((f) => f === component) | ||
.forEach((f) => folders.push(f)); | ||
}); | ||
if (folders.length < components.length) { | ||
console.log("Check if all of these components exist"); | ||
return; | ||
} | ||
if (!fs.existsSync(_path)) { | ||
fs.mkdirSync(_path); | ||
} else { | ||
console.log(`${_path} already exist`); | ||
console.log("Writing new files..."); | ||
} | ||
folders.forEach((f) => { | ||
if (fs.existsSync(`${_path}${f}/`)) { | ||
console.log(`${_path}${f}/ already exist`); | ||
} else { | ||
fs.rename(`${path}${f}/`, `${_path}${f}`, (err) => { | ||
if (err) { | ||
console.log(`Cannot move ${f} component`); | ||
} else { | ||
console.log(`${f} component moved to ${_path}`); | ||
} | ||
}); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { combineComponents } = require("./combine-components"); | ||
|
||
exports.combineComponents = combineComponents; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const { combineComponents } = require("./component"); | ||
const { combineScreens } = require("./screen"); | ||
|
||
exports.combineComponents = combineComponents; | ||
exports.combineScreens = combineScreens; |
Oops, something went wrong.