Skip to content

Commit

Permalink
add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
raojinlin committed Sep 16, 2023
1 parent 182079c commit 59372d5
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 16 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/npm-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# 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://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: "Publish package @raojinlin/create-chrome-extension"

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish --access=public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

`@raojinlin/create-chrome-extension`可以快速生成一个使用React和Ant Destign的Chrome扩展应用。

[![asciicast](https://asciinema.org/a/608318.svg)](https://asciinema.org/a/608318)

## 创建扩展应用
1. 确保你的计算机上已经安装了Node.js的版本为16.0.0或更高版本。如果尚未安装,请访问Node.js官方网站(https://nodejs.org/)并按照指示安装。

Expand Down
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
const clone = require('git-clone/promise');

clone('', '')
require('./tasks/cre');
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@raojinlin/create-chrome-extension",
"version": "1.0.1",
"version": "1.0.0",
"description": "Set up a chrome extension by running one command. ",
"main": "index.js",
"scripts": {
Expand Down
22 changes: 10 additions & 12 deletions tasks/cre.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ const { version } = require('../package.json');


async function cre() {
const packageJson = require('../packages/chrome-extension-react-antd-template/package.json');

const rootDir = path.dirname(__dirname, '..');
const packagesDir = path.join(rootDir, 'packages');
const templateDir = path.join(packagesDir, 'chrome-extension-react-antd-template')
Expand Down Expand Up @@ -48,18 +46,18 @@ async function cre() {
await generateManifestJSON(projectDir);
console.log('🤖 Installing packages. This might take a couple of minutes....');

// process.chdir(projectDir);
// const installProc = child_process.spawn('npm', ['install'], {env: process.env});
// installProc.stdout.pipe(process.stdout);
// installProc.stderr.pipe(process.stderr);
process.chdir(projectDir);
const installProc = child_process.spawn('npm', ['install'], {env: process.env});
installProc.stdout.pipe(process.stdout);
installProc.stderr.pipe(process.stderr);

// installProc.on('error', e => {
// console.error('Install error', e);
// });
installProc.on('error', e => {
console.error('Install error', e);
});

// installProc.on('exit', e => {
// console.log('Packages install success.');
// });
installProc.on('exit', e => {
console.log('Packages install success.');
});
}

cre();

0 comments on commit 59372d5

Please sign in to comment.