forked from DimensionDev/Maskbook
-
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.
feat: npx gulp new-pkg (DimensionDev#5668)
* feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * chore: remove --deps option in clean script cause it does not work with swc * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * feat: npx gulp create-package * docs: update docs * feat: npx gulp create-package * feat: npx gulp create-package * fix: ci
- Loading branch information
1 parent
0e3764a
commit 9d0a712
Showing
38 changed files
with
500 additions
and
160 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
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
Empty file.
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 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"tsBuildInfoFile": "./dist/tests.tsbuildinfo", | ||
"types": ["node"] | ||
}, | ||
"include": ["./tests"], | ||
"references": [{ "path": "./tsconfig.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
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
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,7 @@ | ||
# Example plugin | ||
|
||
## TODOs | ||
|
||
## Referenced resources | ||
|
||
## Known issues / Caveats |
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,12 @@ | ||
{ | ||
"name": "@masknet/plugin-template", | ||
"private": true, | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"dependencies": { | ||
"@masknet/plugin-infra": "workspace:*", | ||
"@masknet/shared": "workspace:*", | ||
"@masknet/shared-base": "workspace:*", | ||
"react-use": "^17.3.2" | ||
} | ||
} |
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,9 @@ | ||
import type { Plugin } from '@masknet/plugin-infra' | ||
import { base } from '../base' | ||
|
||
const dashboard: Plugin.Dashboard.Definition = { | ||
...base, | ||
init(signal, context) {}, | ||
} | ||
|
||
export default dashboard |
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,9 @@ | ||
import type { Plugin } from '@masknet/plugin-infra' | ||
import { base } from '../base' | ||
|
||
const sns: Plugin.SNSAdaptor.Definition = { | ||
...base, | ||
init(signal, context) {}, | ||
} | ||
|
||
export default sns |
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,9 @@ | ||
import type { Plugin } from '@masknet/plugin-infra' | ||
import { base } from '../base' | ||
|
||
const worker: Plugin.Worker.Definition = { | ||
...base, | ||
init(signal, context) {}, | ||
} | ||
|
||
export default worker |
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,18 @@ | ||
import type { Plugin } from '@masknet/plugin-infra' | ||
import { PLUGIN_DESCRIPTION, PLUGIN_ID, PLUGIN_NAME } from './constants' | ||
import { languages } from './locales/languages' | ||
|
||
export const base: Plugin.Shared.Definition = { | ||
ID: PLUGIN_ID, | ||
icon: '\u{1F9EA}', | ||
name: { fallback: PLUGIN_NAME }, | ||
description: { fallback: PLUGIN_DESCRIPTION }, | ||
publisher: { name: { fallback: '' }, link: '' }, | ||
enableRequirement: { | ||
architecture: { app: false, web: true }, | ||
networks: { type: 'opt-out', networks: {} }, | ||
target: 'beta', | ||
}, | ||
experimentalMark: true, | ||
i18n: languages, | ||
} |
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 @@ | ||
import { PluginId } from '@masknet/plugin-infra' | ||
|
||
export const PLUGIN_ID = PluginId.Example | ||
export const PLUGIN_DESCRIPTION = 'An example plugin of Mask Network.' | ||
export const PLUGIN_NAME = 'Example' |
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 @@ | ||
/// <reference types="@masknet/global-types/webpack" /> |
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,23 @@ | ||
import { registerPlugin } from '@masknet/plugin-infra' | ||
import { base } from './base' | ||
|
||
export * from './constants' | ||
|
||
registerPlugin({ | ||
...base, | ||
SNSAdaptor: { | ||
load: () => import('./SNSAdaptor'), | ||
hotModuleReload: (hot) => | ||
import.meta.webpackHot && import.meta.webpackHot.accept('./SNSAdaptor', () => hot(import('./SNSAdaptor'))), | ||
}, | ||
Dashboard: { | ||
load: () => import('./Dashboard'), | ||
hotModuleReload: (hot) => | ||
import.meta.webpackHot && import.meta.webpackHot.accept('./Dashboard', () => hot(import('./Dashboard'))), | ||
}, | ||
Worker: { | ||
load: () => import('./Worker'), | ||
hotModuleReload: (hot) => | ||
import.meta.webpackHot && import.meta.webpackHot.accept('./Worker', () => hot(import('./Worker'))), | ||
}, | ||
}) |
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 @@ | ||
{ | ||
"name": "Example Plugin", | ||
"__entry__": "🤔 Example" | ||
} |
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,6 @@ | ||
// This file is auto generated. DO NOT EDIT | ||
// Run `npx gulp sync-languages` to regenerate. | ||
// Default fallback language in a family of languages are chosen by the alphabet order | ||
// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts | ||
|
||
export * from './i18n_generated' |
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,21 @@ | ||
// This file is auto generated. DO NOT EDIT | ||
// Run `npx gulp sync-languages` to regenerate. | ||
// Default fallback language in a family of languages are chosen by the alphabet order | ||
// To overwrite this, please overwrite packages/scripts/src/locale-kit-next/index.ts | ||
import en_US from './en-US.json' | ||
export const languages = { | ||
en: en_US, | ||
} | ||
import { createI18NBundle } from '@masknet/shared-base' | ||
export const add__template__I18N = createI18NBundle('__template__', languages) | ||
// @ts-ignore | ||
if (import.meta.webpackHot) { | ||
// @ts-ignore | ||
import.meta.webpackHot.accept(['./en-US.json'], () => | ||
globalThis.dispatchEvent?.( | ||
new CustomEvent('MASK_I18N_HMR', { | ||
detail: ['__template__', { en: en_US }], | ||
}), | ||
), | ||
) | ||
} |
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,11 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "src", | ||
"outDir": "dist", | ||
"tsBuildInfoFile": "dist/.tsbuildinfo", | ||
"resolveJsonModule": true | ||
}, | ||
"include": ["src", "src/**/*.json"], | ||
"references": [{ "path": "../../plugin-infra" }, { "path": "../../shared" }, { "path": "../../shared-base" }] | ||
} |
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
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,26 +1,14 @@ | ||
import { awaitChildProcess, parseArgs, printShell, ROOT_PATH, shell, task } from '../utils' | ||
import { awaitChildProcess, printShell, ROOT_PATH, shell, task } from '../utils' | ||
import rimraf from 'rimraf' | ||
import { join } from 'path' | ||
import { promisify } from 'util' | ||
const rm = promisify(rimraf) | ||
|
||
interface Args { | ||
deps: boolean | ||
} | ||
export async function clean() { | ||
const { deps } = parseArgs<Args>() | ||
if (deps) { | ||
printShell`rm -rf **/node_modules` | ||
await rm(join(ROOT_PATH, '**/node_modules')) | ||
await awaitChildProcess(shell.cwd(ROOT_PATH)`git clean -xdf ./packages/`) | ||
} else { | ||
await awaitChildProcess(shell.cwd(ROOT_PATH)`git clean -xdf -e node_modules ./packages/`) | ||
printShell`rm -rf **/node_modules/.cache` | ||
await rm(join(ROOT_PATH, '**/node_modules/.cache')) | ||
} | ||
await awaitChildProcess(shell.cwd(ROOT_PATH)`git clean -xdf -e node_modules ./packages/`) | ||
printShell`rm -rf **/node_modules/.cache` | ||
await rm(join(ROOT_PATH, '**/node_modules/.cache')) | ||
await awaitChildProcess(shell.cwd(ROOT_PATH)`pnpm install --frozen-lockfile --prefer-offline`) | ||
} | ||
|
||
task(clean, 'clean', 'Clean all build caches', { | ||
'--deps': 'including node_modules', | ||
}) | ||
task(clean, 'clean', 'Clean all build caches') |
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,2 +1,3 @@ | ||
export * from './clean' | ||
export * from './help' | ||
export * from './new-package' |
Oops, something went wrong.