extension-create 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/create/README.md +5 -7
- package/create/cli.js +2 -2
- package/create/cli.test.js +3 -5
- package/create/createExtension.js +8 -2
- package/create/messages/directoryHasConflicts.js +9 -11
- package/create/messages/programHelp.js +1 -1
- package/create/messages/successfullInstall.js +1 -1
- package/create/steps/abortProjectAndClean.js +8 -5
- package/create/steps/cleanTemplateFolder.js +1 -1
- package/create/steps/createDirectory.js +9 -13
- package/create/steps/getTemplatePath.js +1 -1
- package/create/steps/importExternalTemplate.js +11 -10
- package/create/steps/importLocalTemplate.js +5 -7
- package/create/steps/installDependencies.js +2 -5
- package/create/steps/writePackageJson.js +7 -7
- package/create/templates/standard/template/manifest.json +21 -25
- package/create/templates/standard/template/newtab/newtab.html +8 -5
- package/create/templates/standard/template/newtab/styles.css +2 -2
- package/create/templates/standard/template/popup/popup.css +2 -2
- package/create/templates/standard/template/popup/popup.html +2 -2
- package/create/templates/standard/template.json +1 -2
- package/develop/README.md +5 -7
- package/develop/module.js +1 -1
- package/develop/package-lock.json +7979 -0
- package/develop/package.json +0 -7
- package/develop/start/cli.js +1 -1
- package/develop/start/cli.test.js +2 -4
- package/develop/start/config/browserSwitch.js +1 -1
- package/develop/start/config/compiler.js +3 -19
- package/develop/start/messages/manifestNotFound.js +1 -1
- package/develop/start/messages/programHelp.js +1 -1
- package/develop/start/resolve/resolveExtensionPath.js +1 -1
- package/develop/start/startExtension.js +6 -3
- package/develop/start/steps/resolveManifest.js +1 -1
- package/develop/start/steps/startWebpack.js +7 -4
- package/develop/yarn.lock +9 -266
- package/package.json +13 -11
- package/preinstall.sh +10 -2
package/develop/package.json
CHANGED
|
@@ -19,21 +19,14 @@
|
|
|
19
19
|
"test": "jest"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@rbarilani/remove-source-map-url-webpack-plugin": "^0.1.0",
|
|
23
|
-
"chrome-launcher": "^0.13.4",
|
|
24
22
|
"commander": "^6.2.0",
|
|
25
|
-
"copy-webpack-plugin": "^6.2.1",
|
|
26
23
|
"fs-extra": "^9.0.1",
|
|
27
24
|
"go-git-it": "github:cezaraugusto/go-git-it#174168d12a31791a08c777b92650f98470d45674",
|
|
28
25
|
"log-md": "^0.2.0",
|
|
29
26
|
"semver": "^7.3.2",
|
|
30
|
-
"string-replace-loader": "^2.3.0",
|
|
31
|
-
"symlink-dir": "^4.1.0",
|
|
32
|
-
"webextension-polyfill": "^0.6.0",
|
|
33
27
|
"webpack": "^5.6.0",
|
|
34
28
|
"webpack-cli": "^4.1.0",
|
|
35
29
|
"webpack-dev-server": "^3.11.0",
|
|
36
|
-
"webpack-resolve-background-script": "^1.0.0",
|
|
37
30
|
"webpack-run-chrome-extension": "^0.3.0",
|
|
38
31
|
"webpack-run-edge-extension": "^0.3.0"
|
|
39
32
|
},
|
package/develop/start/cli.js
CHANGED
|
@@ -8,14 +8,12 @@ const boringManifestFile = {
|
|
|
8
8
|
name: 'Your browser extension',
|
|
9
9
|
version: '1.0',
|
|
10
10
|
background: {
|
|
11
|
-
scripts: [
|
|
12
|
-
'./background.js'
|
|
13
|
-
]
|
|
11
|
+
scripts: ['./background.js']
|
|
14
12
|
}
|
|
15
13
|
}
|
|
16
14
|
|
|
17
15
|
/* eslint-disable no-unused-vars */
|
|
18
|
-
async function createTmpExtension
|
|
16
|
+
async function createTmpExtension() {
|
|
19
17
|
// Write a fake bg script
|
|
20
18
|
await fs.writeFile(
|
|
21
19
|
path.join(process.cwd(), 'background.js'),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const RunChromeExtension = require('webpack-run-chrome-extension')
|
|
2
2
|
const RunEdgeExtension = require('webpack-run-edge-extension')
|
|
3
3
|
|
|
4
|
-
module.exports = function (projectDir, browserVendor) {
|
|
4
|
+
module.exports = function browserSwitch(projectDir, browserVendor) {
|
|
5
5
|
switch (browserVendor) {
|
|
6
6
|
case 'chrome':
|
|
7
7
|
return new RunChromeExtension({extensionPath: projectDir})
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
// ███████║ ██║ ██║ ██║██║ ██║ ██║
|
|
6
6
|
// ╚══════╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
|
|
7
7
|
|
|
8
|
-
const webpack = require('webpack')
|
|
9
|
-
|
|
10
8
|
const browserSwitch = require('./browserSwitch')
|
|
11
9
|
|
|
12
|
-
process.on('unhandledRejection', (error) => {
|
|
10
|
+
process.on('unhandledRejection', (error) => {
|
|
11
|
+
throw error
|
|
12
|
+
})
|
|
13
13
|
|
|
14
14
|
module.exports = (projectDir, {browserVendor}) => {
|
|
15
15
|
const config = {
|
|
@@ -17,27 +17,11 @@ module.exports = (projectDir, {browserVendor}) => {
|
|
|
17
17
|
// https://github.com/webpack/webpack/issues/2145
|
|
18
18
|
devtool: 'inline-cheap-module-source-map',
|
|
19
19
|
plugins: [
|
|
20
|
-
// Polyfill `browser` namespace for unspported browsers (FF).
|
|
21
|
-
// TODO: Do not add this plugin when developing for those vendors
|
|
22
|
-
new webpack.ProvidePlugin({browser: require.resolve('webextension-polyfill')}),
|
|
23
20
|
// Browser lists loaded conditionally based on user choice
|
|
24
21
|
browserSwitch(projectDir, browserVendor)
|
|
25
22
|
],
|
|
26
23
|
resolve: {
|
|
27
24
|
extensions: ['js', '.json']
|
|
28
|
-
},
|
|
29
|
-
module: {
|
|
30
|
-
// Adapted from
|
|
31
|
-
// https://github.com/webextension-toolbox/webextension-toolbox
|
|
32
|
-
// Relased under MIT license. Copyright 2018 Henrik Wenz
|
|
33
|
-
rules: [{
|
|
34
|
-
test: /webextension-polyfill[\\/]+dist[\\/]+browser-polyfill\.js$/,
|
|
35
|
-
loader: require.resolve('string-replace-loader'),
|
|
36
|
-
options: {
|
|
37
|
-
search: 'typeof browser === "undefined"',
|
|
38
|
-
replace: 'typeof window.browser === "undefined" || Object.getPrototypeOf(window.browser) !== Object.prototype'
|
|
39
|
-
}
|
|
40
|
-
}]
|
|
41
25
|
}
|
|
42
26
|
}
|
|
43
27
|
|
|
@@ -11,7 +11,7 @@ const fs = require('fs-extra')
|
|
|
11
11
|
|
|
12
12
|
const message = require('../messages')
|
|
13
13
|
|
|
14
|
-
module.exports = async function (workingDir, manifestFile) {
|
|
14
|
+
module.exports = async function resolveExtensionPath(workingDir, manifestFile) {
|
|
15
15
|
// Defaults to user-defined path
|
|
16
16
|
let manifestFilePath = manifestFile
|
|
17
17
|
|
|
@@ -14,7 +14,7 @@ const goGitIt = require('go-git-it')
|
|
|
14
14
|
const resoleManifest = require('./steps/resolveManifest')
|
|
15
15
|
const startWebpack = require('./steps/startWebpack')
|
|
16
16
|
|
|
17
|
-
function setWorkingDirFromRemote
|
|
17
|
+
function setWorkingDirFromRemote(workingDir, customPath) {
|
|
18
18
|
if (new URL(customPath).hostname !== 'github.com') {
|
|
19
19
|
log(`
|
|
20
20
|
The remote extension URL must be stored on GitHub.
|
|
@@ -27,7 +27,7 @@ function setWorkingDirFromRemote (workingDir, customPath) {
|
|
|
27
27
|
return path.join(workingDir, path.basename(customPath))
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
async function setWorkingDirFromLocal
|
|
30
|
+
async function setWorkingDirFromLocal(workingDir, customPath) {
|
|
31
31
|
const currentPath = path.resolve(workingDir, customPath)
|
|
32
32
|
const extensionPath = await fs.stat(currentPath)
|
|
33
33
|
|
|
@@ -41,7 +41,10 @@ async function setWorkingDirFromLocal (workingDir, customPath) {
|
|
|
41
41
|
return currentPath
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
module.exports = async function (
|
|
44
|
+
module.exports = async function startExtension(
|
|
45
|
+
workingDir,
|
|
46
|
+
{customPath, browserVendor}
|
|
47
|
+
) {
|
|
45
48
|
let currentworkingDir
|
|
46
49
|
|
|
47
50
|
try {
|
|
@@ -11,7 +11,7 @@ const fs = require('fs-extra')
|
|
|
11
11
|
|
|
12
12
|
const message = require('../messages')
|
|
13
13
|
|
|
14
|
-
module.exports = async function (workingDir) {
|
|
14
|
+
module.exports = async function resolveManifest(workingDir) {
|
|
15
15
|
let manifestFilePath
|
|
16
16
|
|
|
17
17
|
// Iterate over common paths looking for the manifest file.
|
|
@@ -11,15 +11,18 @@ const webpack = require('webpack')
|
|
|
11
11
|
const {log} = require('log-md')
|
|
12
12
|
const WebpackDevServer = require('webpack-dev-server')
|
|
13
13
|
|
|
14
|
-
const compilerConfig = require('../config/compiler
|
|
15
|
-
const serverConfig = require('../config/server
|
|
14
|
+
const compilerConfig = require('../config/compiler')
|
|
15
|
+
const serverConfig = require('../config/server')
|
|
16
16
|
|
|
17
|
-
function closeAll
|
|
17
|
+
function closeAll(devServer) {
|
|
18
18
|
devServer.close()
|
|
19
19
|
process.exit()
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
module.exports = function (
|
|
22
|
+
module.exports = function startWebpack(
|
|
23
|
+
projectDir,
|
|
24
|
+
{manifestPath, browserVendor}
|
|
25
|
+
) {
|
|
23
26
|
const serverOptions = {
|
|
24
27
|
// Tell the server where to serve content from
|
|
25
28
|
contentBase: path.dirname(manifestPath)
|