-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db74cc3
commit 7bc1bb9
Showing
5 changed files
with
7,167 additions
and
16,674 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Publish job | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
publish_npm: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
- name: Install Dependencies | ||
run: npm ci | ||
- name: Linting | ||
run: npm run lint | ||
- name: Test | ||
run: npm run test-no-watch | ||
- uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
access: "public" | ||
token: ${{ secrets.NPM_AUTH_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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env node | ||
|
||
const { execSync } = require("child_process"); | ||
const path = require("path"); | ||
const fs = require("fs"); | ||
|
||
if (process.argv.length < 3) { | ||
console.log("You have to provide a name to your app."); | ||
console.log("For example :"); | ||
console.log("npx create-clean-react-app my-app"); | ||
process.exit(1); | ||
} | ||
|
||
const projectName = process.argv[2]; | ||
const currentPath = process.cwd(); | ||
const projectPath = path.join(currentPath, projectName); | ||
const git_repo = | ||
"git@github.com:onemanfighter/create-clean-react-app-publish.git"; | ||
|
||
try { | ||
fs.mkdirSync(projectPath); | ||
} catch (err) { | ||
if (err.code === "EEXIST") { | ||
console.log( | ||
`The file ${projectName} already exist in the current directory, please give it another name.` | ||
); | ||
} else { | ||
console.log(err); | ||
} | ||
process.exit(1); | ||
} | ||
|
||
async function main() { | ||
try { | ||
console.log("Downloading files..."); | ||
execSync(`git clone --depth 1 ${git_repo} ${projectPath}`); | ||
|
||
process.chdir(projectPath); | ||
|
||
console.log("Installing dependencies..."); | ||
execSync("yarn install"); | ||
|
||
console.log("Removing useless files"); | ||
execSync("npx rimraf ./.git"); | ||
fs.rmdirSync(path.join(projectPath, "bin"), { recursive: true }); | ||
|
||
console.log("The installation is done, this is ready to use !"); | ||
} catch (error) { | ||
console.log(error); | ||
} | ||
} | ||
main(); |
Oops, something went wrong.