generated from capacitor-community/.github
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Showing
28 changed files
with
592 additions
and
477 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,4 @@ | ||
plugin-examples | ||
dist | ||
docs | ||
node_modules |
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,4 @@ | ||
// eslint-disable-next-line no-undef | ||
module.exports = { | ||
extends: '@ionic/eslint-config/recommended', | ||
}; |
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,33 +1,38 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: CI | ||
|
||
# Controls when the action will run. Triggers the workflow on push or pull request | ||
# events but only for the master branch | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- "**" | ||
pull_request: | ||
branches: | ||
- "**" | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
lint: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
steps: | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- uses: actions/checkout@v2 | ||
- run: npm install | ||
- run: npm run lint | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
steps: | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
node-version: 14.x | ||
- uses: actions/checkout@v2 | ||
- run: npm install | ||
- run: npm run build |
This file was deleted.
Oops, something went wrong.
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,10 @@ | ||
plugin-examples/** | ||
docs/** | ||
.github/** | ||
.husky/** | ||
dist/** | ||
node_modules/** | ||
*.md | ||
*.sh | ||
package.json | ||
package-lock.json |
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,4 @@ | ||
// eslint-disable-next-line no-undef | ||
module.exports = { | ||
...require('@ionic/prettier-config'), | ||
}; |
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,17 +1,21 @@ | ||
require('esbuild').build({ | ||
entryPoints: ['src/cli-scripts/index.ts'], | ||
bundle: true, | ||
outfile: 'dist/cli-scripts/cap-scripts.js', | ||
platform: 'node', | ||
target: 'node14', | ||
minify: true, | ||
external: [ | ||
'child_process', | ||
'fs', | ||
'path', | ||
'fs-extra', | ||
'crypto', | ||
'chalk', | ||
'ora' | ||
] | ||
}).catch(() => process.exit(1)) | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
require('esbuild') | ||
.build({ | ||
entryPoints: ['src/cli-scripts/index.ts'], | ||
bundle: true, | ||
outfile: 'dist/cli-scripts/cap-scripts.js', | ||
platform: 'node', | ||
target: 'node14', | ||
minify: true, | ||
external: [ | ||
'child_process', | ||
'fs', | ||
'path', | ||
'fs-extra', | ||
'crypto', | ||
'chalk', | ||
'ora', | ||
], | ||
}) | ||
.catch(() => process.exit(1)); |
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,15 +1,13 @@ | ||
require('esbuild').build({ | ||
entryPoints: ['src/electron/index.ts'], | ||
bundle: true, | ||
outfile: 'dist/core/index.js', | ||
platform: 'node', | ||
target: 'node14', | ||
minify: true, | ||
external: [ | ||
'electron', | ||
'fs', | ||
'path', | ||
'mime-types', | ||
'events', | ||
] | ||
}).catch(() => process.exit(1)) | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
require('esbuild') | ||
.build({ | ||
entryPoints: ['src/electron/index.ts'], | ||
bundle: true, | ||
outfile: 'dist/core/index.js', | ||
platform: 'node', | ||
target: 'node14', | ||
minify: true, | ||
external: ['electron', 'fs', 'path', 'mime-types', 'events'], | ||
}) | ||
.catch(() => process.exit(1)); |
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,16 +1,18 @@ | ||
"use strict"; | ||
const config = require("conventional-changelog-conventionalcommits"); | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
'use strict'; | ||
const config = require('conventional-changelog-conventionalcommits'); | ||
|
||
module.exports = config({ | ||
types: [ | ||
{ type: "feat", section: "Features" }, | ||
{ type: "fix", section: "Bug Fixes" }, | ||
{ type: "chore", section: "Chores" }, | ||
{ type: "docs", section: "Documentation" }, | ||
{ type: "style", hidden: true }, | ||
{ type: "refactor", hidden: true }, | ||
{ type: "perf", hidden: true }, | ||
{ type: "test", hidden: true }, | ||
{ type: "changelog", hidden: true }, | ||
{ type: 'feat', section: 'Features' }, | ||
{ type: 'fix', section: 'Bug Fixes' }, | ||
{ type: 'chore', section: 'Chores' }, | ||
{ type: 'docs', section: 'Documentation' }, | ||
{ type: 'style', hidden: true }, | ||
{ type: 'refactor', hidden: true }, | ||
{ type: 'perf', hidden: true }, | ||
{ type: 'test', hidden: true }, | ||
{ type: 'changelog', hidden: true }, | ||
], | ||
}); |
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 |
---|---|---|
@@ -1,65 +1,62 @@ | ||
import { existsSync, renameSync } from "fs"; | ||
import { copySync } from "fs-extra"; | ||
import { join } from "path"; | ||
import { readJSON, runExec, writePrettyJSON } from "./common"; | ||
import { existsSync, renameSync } from 'fs'; | ||
import { copySync } from 'fs-extra'; | ||
import { join } from 'path'; | ||
|
||
export async function doAdd() { | ||
try { | ||
//console.log(process.env.CAPACITOR_ROOT_DIR); | ||
//console.log(process.env.CAPACITOR_WEB_DIR); | ||
//console.log(process.env.CAPACITOR_CONFIG); | ||
const usersProjectDir = process.env.CAPACITOR_ROOT_DIR!; | ||
const capacitorElectronNodeModuleTemplateDir = join( | ||
usersProjectDir, | ||
"node_modules", | ||
"@capacitor-community", | ||
"electron", | ||
"template" | ||
); | ||
const destDir = join(usersProjectDir, "electron"); | ||
let usersProjectCapConfigFile: string | undefined = undefined; | ||
let configFileName: string | undefined = undefined; | ||
import { readJSON, runExec, writePrettyJSON } from './common'; | ||
|
||
const configFileOptions = { | ||
ts: join(usersProjectDir, "capacitor.config.ts"), | ||
js: join(usersProjectDir, "capacitor.config.js"), | ||
json: join(usersProjectDir, "capacitor.config.json"), | ||
} | ||
if (existsSync(configFileOptions.ts)) { | ||
usersProjectCapConfigFile = configFileOptions.ts | ||
configFileName = "capacitor.config.ts" | ||
} else if (existsSync(configFileOptions.js)) { | ||
usersProjectCapConfigFile = configFileOptions.js | ||
configFileName = "capacitor.config.js" | ||
} else { | ||
usersProjectCapConfigFile = configFileOptions.json | ||
configFileName = "capacitor.config.json" | ||
} | ||
export async function doAdd(): Promise<void> { | ||
//console.log(process.env.CAPACITOR_ROOT_DIR); | ||
//console.log(process.env.CAPACITOR_WEB_DIR); | ||
//console.log(process.env.CAPACITOR_CONFIG); | ||
const usersProjectDir = process.env.CAPACITOR_ROOT_DIR; | ||
const capacitorElectronNodeModuleTemplateDir = join( | ||
usersProjectDir, | ||
'node_modules', | ||
'@capacitor-community', | ||
'electron', | ||
'template', | ||
); | ||
const destDir = join(usersProjectDir, 'electron'); | ||
let usersProjectCapConfigFile: string | undefined = undefined; | ||
let configFileName: string | undefined = undefined; | ||
|
||
const configData = JSON.parse(process.env.CAPACITOR_CONFIG!); | ||
const configFileOptions = { | ||
ts: join(usersProjectDir, 'capacitor.config.ts'), | ||
js: join(usersProjectDir, 'capacitor.config.js'), | ||
json: join(usersProjectDir, 'capacitor.config.json'), | ||
}; | ||
if (existsSync(configFileOptions.ts)) { | ||
usersProjectCapConfigFile = configFileOptions.ts; | ||
configFileName = 'capacitor.config.ts'; | ||
} else if (existsSync(configFileOptions.js)) { | ||
usersProjectCapConfigFile = configFileOptions.js; | ||
configFileName = 'capacitor.config.js'; | ||
} else { | ||
usersProjectCapConfigFile = configFileOptions.json; | ||
configFileName = 'capacitor.config.json'; | ||
} | ||
|
||
const configData = JSON.parse(process.env.CAPACITOR_CONFIG); | ||
|
||
const builtWebAppDir = process.env.CAPACITOR_WEB_DIR!; | ||
const builtWebAppDir = process.env.CAPACITOR_WEB_DIR; | ||
|
||
if (!existsSync(destDir)) { | ||
copySync(capacitorElectronNodeModuleTemplateDir, destDir); | ||
copySync(usersProjectCapConfigFile, join(destDir, configFileName)); | ||
// writeFileSync( | ||
// join(destDir, "capacitor.config.json"), | ||
// JSON.stringify(configData) | ||
// ); | ||
renameSync(join(destDir, "gitignore"), join(destDir, ".gitignore")); | ||
copySync(builtWebAppDir, join(destDir, "app")); | ||
if (!existsSync(destDir)) { | ||
copySync(capacitorElectronNodeModuleTemplateDir, destDir); | ||
copySync(usersProjectCapConfigFile, join(destDir, configFileName)); | ||
// writeFileSync( | ||
// join(destDir, "capacitor.config.json"), | ||
// JSON.stringify(configData) | ||
// ); | ||
renameSync(join(destDir, 'gitignore'), join(destDir, '.gitignore')); | ||
copySync(builtWebAppDir, join(destDir, 'app')); | ||
|
||
const appName: string = configData.appName!; | ||
const electronPackageJson = readJSON(join(destDir, "package.json")); | ||
electronPackageJson.name = appName; | ||
writePrettyJSON(join(destDir, "package.json"), electronPackageJson); | ||
const appName: string = configData.appName; | ||
const electronPackageJson = readJSON(join(destDir, 'package.json')); | ||
electronPackageJson.name = appName; | ||
writePrettyJSON(join(destDir, 'package.json'), electronPackageJson); | ||
|
||
await runExec(`cd ${destDir} && npm i`); | ||
} else { | ||
throw new Error("Electron platform already exists."); | ||
} | ||
} catch (e) { | ||
throw e; | ||
await runExec(`cd ${destDir} && npm i`); | ||
} else { | ||
throw new Error('Electron platform already exists.'); | ||
} | ||
} |
Oops, something went wrong.