generator-reshow 0.17.73 → 0.17.74
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/generators/docker/templates/_circleci/config.yml +1 -0
- package/generators/docker/templates/compile.sh +35 -1
- package/generators/docker/templates/tests/smoke_test.go +9 -1
- package/generators/npm/index.js +1 -1
- package/package.json +1 -1
- package/generators/library/README.md +0 -9
- package/generators/library/__tests__/Test.js +0 -43
- package/generators/library/index.js +0 -70
- package/generators/library/templates/README.md +0 -15
- package/generators/library/templates/Test.js +0 -10
- package/generators/library/templates/compile.sh +0 -3
- package/generators/library/templates/package.json +0 -37
- package/generators/library/templates/src/index.js +0 -3
|
@@ -43,6 +43,37 @@ login() {
|
|
|
43
43
|
fi
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
getJSONField() {
|
|
47
|
+
text=$1
|
|
48
|
+
field=$2
|
|
49
|
+
echo $text | sed -n 's|.*"'${field}'"\s*:\s*"\([^"]*\)".*|\1|p'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getToken() {
|
|
53
|
+
RESULT=$(
|
|
54
|
+
curl -kX POST \
|
|
55
|
+
-H "Content-Type: application/json" \
|
|
56
|
+
-d '{"username": "'$DOCKER_LOGIN'", "password": "'$DOCKER_PASSWORD'"}' \
|
|
57
|
+
https://hub.docker.com/v2/users/login
|
|
58
|
+
)
|
|
59
|
+
echo $(getJSONField $RESULT token)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
updateDockerHubDesc() {
|
|
63
|
+
token=$(getToken)
|
|
64
|
+
if [ -e "README.md" ]; then
|
|
65
|
+
full_description=$(jq -s -R . README.md)
|
|
66
|
+
fi
|
|
67
|
+
data="{\"full_description\": ${full_description:-""} }"
|
|
68
|
+
RESULT=$(
|
|
69
|
+
curl -kX PATCH https://hub.docker.com/v2/repositories/${remoteImage} \
|
|
70
|
+
-H "Content-Type: application/json" \
|
|
71
|
+
-H "Authorization: JWT $token" \
|
|
72
|
+
-d "$data"
|
|
73
|
+
)
|
|
74
|
+
echo $RESULT
|
|
75
|
+
}
|
|
76
|
+
|
|
46
77
|
push() {
|
|
47
78
|
login
|
|
48
79
|
PUSH_VERSION=${1:-$VERSION}
|
|
@@ -89,7 +120,7 @@ build() {
|
|
|
89
120
|
if [ 'x' != "x$NO_CACHE" ]; then
|
|
90
121
|
echo nocache: ${NO_CACHE}
|
|
91
122
|
fi
|
|
92
|
-
docker build ${BUILD_ARG} ${NO_CACHE} -f ${DIR}/${DOCKER_FILE} -t $localImage ${DIR}
|
|
123
|
+
docker build --progress=plain ${BUILD_ARG} ${NO_CACHE} -f ${DIR}/${DOCKER_FILE} -t $localImage ${DIR}
|
|
93
124
|
list
|
|
94
125
|
}
|
|
95
126
|
|
|
@@ -113,6 +144,9 @@ case "$1" in
|
|
|
113
144
|
login)
|
|
114
145
|
login
|
|
115
146
|
;;
|
|
147
|
+
updateDockerHubDesc)
|
|
148
|
+
updateDockerHubDesc
|
|
149
|
+
;;
|
|
116
150
|
p)
|
|
117
151
|
push $2 $3
|
|
118
152
|
;;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
package test
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
|
+
"bytes"
|
|
5
|
+
"fmt"
|
|
6
|
+
"os/exec"
|
|
4
7
|
"testing"
|
|
8
|
+
|
|
5
9
|
"github.com/gruntwork-io/terratest/modules/docker"
|
|
6
10
|
"github.com/stretchr/testify/assert"
|
|
7
11
|
)
|
|
@@ -9,8 +13,12 @@ import (
|
|
|
9
13
|
func TestSmoke(t *testing.T) {
|
|
10
14
|
// website::tag::1:: Configure the tag to use on the Docker image.
|
|
11
15
|
tag := "docker-smoke"
|
|
16
|
+
VERSION, err := exec.Command("../support/VERSION.sh").Output()
|
|
17
|
+
if err == nil {
|
|
18
|
+
}
|
|
12
19
|
buildOptions := &docker.BuildOptions{
|
|
13
|
-
Tags:
|
|
20
|
+
Tags: []string{tag},
|
|
21
|
+
BuildArgs: []string{fmt.Sprintf("VERSION=%s", bytes.TrimRight(VERSION, "\n"))},
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
// website::tag::2:: Build the Docker image.
|
package/generators/npm/index.js
CHANGED
|
@@ -54,7 +54,7 @@ module.exports = class extends YoGenerator {
|
|
|
54
54
|
|
|
55
55
|
writing() {
|
|
56
56
|
this.env.options.nodePackageManager = "yarn";
|
|
57
|
-
const { cp, chMainName
|
|
57
|
+
const { cp, chMainName } = YoHelper(this);
|
|
58
58
|
const { isUseBabel, isUseBabelUI } = this.payload || {};
|
|
59
59
|
|
|
60
60
|
// handle change to new folder
|
package/package.json
CHANGED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* https://yeoman.io/authoring/testing.html
|
|
3
|
-
* https://gilsondev.gitbooks.io/yeoman-authoring/content/authoring/unit_testing.html
|
|
4
|
-
*
|
|
5
|
-
* https://github.com/yeoman/yeoman-assert/blob/main/index.js
|
|
6
|
-
* https://github.com/yeoman/yeoman-test/blob/main/lib/run-context.js
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
const { YoTest, assert } = require("yo-unit");
|
|
10
|
-
|
|
11
|
-
describe("!! library !!", () => {
|
|
12
|
-
let runResult;
|
|
13
|
-
|
|
14
|
-
before(async () => {
|
|
15
|
-
runResult = await YoTest({
|
|
16
|
-
source: __dirname + "/../.",
|
|
17
|
-
params: {
|
|
18
|
-
isReady: true,
|
|
19
|
-
description: "foo-desc",
|
|
20
|
-
keyword: "foo-keyword",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
after(() => {
|
|
26
|
-
if (runResult) {
|
|
27
|
-
runResult.restore();
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it("should have folder", () => {
|
|
32
|
-
// assert.file(["src", "ui"]);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should have file", () => {
|
|
36
|
-
// assert.file(["compile.sh", "index.html"]);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("should have content", () => {
|
|
40
|
-
// assert.fileContent('composer.json', 'foo-desc');
|
|
41
|
-
// assert.fileContent('.circleci/config.yml', 'foo');
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const { YoGenerator, YoHelper, commonPrompt } = require("yo-reshow");
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Library Generator
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
module.exports = class extends YoGenerator {
|
|
8
|
-
/**
|
|
9
|
-
* Run loop (Life cycle)
|
|
10
|
-
* https://yeoman.io/authoring/running-context.html#the-run-loop
|
|
11
|
-
*
|
|
12
|
-
* 1. initializing
|
|
13
|
-
* 2. prompting
|
|
14
|
-
* 3. configuring
|
|
15
|
-
* 4. default
|
|
16
|
-
* 5. writing
|
|
17
|
-
* 6. conflicts
|
|
18
|
-
* 7. install
|
|
19
|
-
* 8. end
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Questions.
|
|
24
|
-
*
|
|
25
|
-
* https://www.alwaystwisted.com/post.php?s=using-lists-in-a-yeoman-generator
|
|
26
|
-
* https://github.com/SBoudrias/Inquirer.js
|
|
27
|
-
*/
|
|
28
|
-
async prompting() {
|
|
29
|
-
const {
|
|
30
|
-
handleAnswers,
|
|
31
|
-
mergePromptOrOption,
|
|
32
|
-
promptChainLocator,
|
|
33
|
-
promptChain,
|
|
34
|
-
} = YoHelper(this);
|
|
35
|
-
|
|
36
|
-
const prompts = [
|
|
37
|
-
...commonPrompt.mainName(this),
|
|
38
|
-
...commonPrompt.desc(this),
|
|
39
|
-
...commonPrompt.author(this),
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const answers = await mergePromptOrOption(prompts, (nextPrompts) =>
|
|
43
|
-
promptChain(promptChainLocator(nextPrompts))
|
|
44
|
-
);
|
|
45
|
-
handleAnswers(answers);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
writing() {
|
|
49
|
-
this.env.options.nodePackageManager = "yarn";
|
|
50
|
-
const { cp, chMainName } = YoHelper(this);
|
|
51
|
-
|
|
52
|
-
// handle change to new folder
|
|
53
|
-
chMainName(this.mainName);
|
|
54
|
-
|
|
55
|
-
// handle copy file
|
|
56
|
-
cp("README.md", null, this.payload);
|
|
57
|
-
cp("compile.sh", null, this.payload);
|
|
58
|
-
cp("package.json", null, this.payload);
|
|
59
|
-
cp("src", null, this.payload);
|
|
60
|
-
cp("Test.js", "src/__tests__/Test.js", this.payload);
|
|
61
|
-
// cp("yarn.lock");
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
end() {
|
|
65
|
-
if (!this.options.skipInstall) {
|
|
66
|
-
const { say, onExit } = YoHelper(this);
|
|
67
|
-
onExit(() => say('Next you could try "npm run build" or "npm run test"'));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<%= mainName %>",
|
|
3
|
-
"repository": {
|
|
4
|
-
"type": "git",
|
|
5
|
-
"url": "https://github.com/react-atomic/react-atomic-organism",
|
|
6
|
-
"directory": "packages/lib/<%= mainName %>"
|
|
7
|
-
},
|
|
8
|
-
"homepage": "https://github.com/react-atomic/react-atomic-organism/tree/main/packages/lib/<%= mainName %>",
|
|
9
|
-
"description": "<%= description %>",
|
|
10
|
-
"version": "0.0.0",
|
|
11
|
-
"main": "./build/cjs/src/index.js",
|
|
12
|
-
"module": "./build/es/src/index.js",
|
|
13
|
-
"keywords": [],
|
|
14
|
-
"author": "<%= authorName %> <<%= authorEmail %>>",
|
|
15
|
-
"license": "ISC",
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"reshow-constant": "*"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@babel/cli": "^7.x",
|
|
21
|
-
"reshow-unit": "*"
|
|
22
|
-
},
|
|
23
|
-
"scripts": {
|
|
24
|
-
"clean": "find ./build ./types -name '*.*' | xargs rm -rf",
|
|
25
|
-
"build:cjs": "BABEL_ENV=cjs babel src -d build/cjs/src --ignore /**/__tests__ --root-mode upward",
|
|
26
|
-
"build:es": "BABEL_ENV=es babel src -d build/es/src --out-file-extension .mjs --root-mode upward",
|
|
27
|
-
"build:type": "npx -p typescript tsc src/*.js --declaration --allowJs --emitDeclarationOnly --skipLibCheck --declarationDir types",
|
|
28
|
-
"build": "npm run clean && npm run build:cjs && npm run build:es && npm run build:type",
|
|
29
|
-
"mochaFor": "mocha -r global-jsdom/register",
|
|
30
|
-
"mocha": "npm run mochaFor -- 'build/es/**/__tests__/*.mjs'",
|
|
31
|
-
"test:report": "npm run build && npm run mochaFor -- --reporter mocha-junit-reporter --reporter-options mochaFile=./test_output/mocha.xml 'build/es/**/__tests__/*.mjs'",
|
|
32
|
-
"test": "npm run build && npm run mocha",
|
|
33
|
-
"prepublishOnly": "npm run test"
|
|
34
|
-
},
|
|
35
|
-
"types": "./types/index.d.ts",
|
|
36
|
-
"files": ["types", "build", "package.json", "README.md"]
|
|
37
|
-
}
|