@linktr.ee/create-link-app 0.3.0-next.47 → 0.3.0-next.6
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 +2 -34
- package/dist/commands/build.js +3 -19
- package/dist/commands/dev.js +1 -2
- package/dist/lib/create/create-project.js +0 -4
- package/dist/lib/deploy/create-form-data.js +0 -5
- package/dist/lib/deploy/pack-project.js +1 -12
- package/dist/webpack/webpack.config.js +20 -40
- package/oclif.manifest.json +1 -38
- package/package.json +10 -30
- package/templates/common/README.md +17 -38
- package/templates/common/fixtures/props-data.json +2 -1
- package/templates/common/gitignore +0 -2
- package/templates/common/settings.json +23 -11
- package/templates/react/package.json +2 -5
- package/templates/react/src/images/logo.png +0 -0
- package/templates/react/src/index.jsx +13 -4
- package/templates/react-ts/package.json +5 -33
- package/templates/react-ts/src/images/logo.png +0 -0
- package/templates/react-ts/src/index.tsx +19 -0
- package/templates/react-ts/src/types/global.d.ts +5 -2
- package/templates/react-ts/src/types/index.ts +7 -8
- package/templates/react-ts/tsconfig.json +1 -0
- package/dist/commands/generate-types.js +0 -111
- package/dist/commands/storybook.js +0 -28
- package/dist/lib/schema/compile.js +0 -30
- package/dist/postcss/postcss.config.js +0 -31
- package/dist/storybook/global.css +0 -53
- package/dist/storybook/main.js +0 -62
- package/dist/storybook/preview.js +0 -21
- package/templates/common/schema/editablePrivate.jtd.json +0 -6
- package/templates/common/schema/editablePublic.jtd.json +0 -10
- package/templates/common/schema/readonlyPrivate.jtd.json +0 -8
- package/templates/common/schema/readonlyPublic.jtd.json +0 -6
- package/templates/common/schema/system.jtd.json +0 -6
- package/templates/react/src/tailwind.css +0 -5
- package/templates/react-ts/src/App.tsx +0 -23
- package/templates/react-ts/src/Editor.tsx +0 -7
- package/templates/react-ts/src/Sheet.tsx +0 -7
- package/templates/react-ts/src/components/Layouts.tsx +0 -59
- package/templates/react-ts/src/stories/LinkApp.stories.tsx +0 -94
- package/templates/react-ts/src/stories/tailwind.sb.css +0 -5
- package/templates/react-ts/src/tailwind.css +0 -4
- package/templates/react-ts/src/types/hack.d.ts +0 -8
- package/templates/react-ts/src/types/schema/index.ts +0 -33
package/README.md
CHANGED
|
@@ -23,12 +23,10 @@ yarn create @linktr.ee/create-link-app my-link-app
|
|
|
23
23
|
* [`create-link-app create NAME`](#create-link-app-create-name)
|
|
24
24
|
* [`create-link-app deploy`](#create-link-app-deploy)
|
|
25
25
|
* [`create-link-app dev`](#create-link-app-dev)
|
|
26
|
-
* [`create-link-app generate-types`](#create-link-app-generate-types)
|
|
27
26
|
* [`create-link-app grant-access LINK_APP_ID USERNAME`](#create-link-app-grant-access-link_app_id-username)
|
|
28
27
|
* [`create-link-app help [COMMANDS]`](#create-link-app-help-commands)
|
|
29
28
|
* [`create-link-app login`](#create-link-app-login)
|
|
30
29
|
* [`create-link-app logout`](#create-link-app-logout)
|
|
31
|
-
* [`create-link-app storybook`](#create-link-app-storybook)
|
|
32
30
|
|
|
33
31
|
## `create-link-app build`
|
|
34
32
|
|
|
@@ -36,10 +34,7 @@ Build Link App project to static assets used for production
|
|
|
36
34
|
|
|
37
35
|
```
|
|
38
36
|
USAGE
|
|
39
|
-
$ create-link-app build
|
|
40
|
-
|
|
41
|
-
FLAGS
|
|
42
|
-
--native Build native components of a Link App ready for publishing to npm
|
|
37
|
+
$ create-link-app build
|
|
43
38
|
|
|
44
39
|
DESCRIPTION
|
|
45
40
|
Build Link App project to static assets used for production
|
|
@@ -111,18 +106,6 @@ EXAMPLES
|
|
|
111
106
|
$ create-link-app dev --https
|
|
112
107
|
```
|
|
113
108
|
|
|
114
|
-
## `create-link-app generate-types`
|
|
115
|
-
|
|
116
|
-
Generate Typescript types from the schema definitions
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
USAGE
|
|
120
|
-
$ create-link-app generate-types
|
|
121
|
-
|
|
122
|
-
DESCRIPTION
|
|
123
|
-
Generate Typescript types from the schema definitions
|
|
124
|
-
```
|
|
125
|
-
|
|
126
109
|
## `create-link-app grant-access LINK_APP_ID USERNAME`
|
|
127
110
|
|
|
128
111
|
Grant access to other developers to push updates for your Link App
|
|
@@ -160,7 +143,7 @@ DESCRIPTION
|
|
|
160
143
|
Display help for create-link-app.
|
|
161
144
|
```
|
|
162
145
|
|
|
163
|
-
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.
|
|
146
|
+
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
|
|
164
147
|
|
|
165
148
|
## `create-link-app login`
|
|
166
149
|
|
|
@@ -185,19 +168,4 @@ USAGE
|
|
|
185
168
|
DESCRIPTION
|
|
186
169
|
Logout and clear browser session
|
|
187
170
|
```
|
|
188
|
-
|
|
189
|
-
## `create-link-app storybook`
|
|
190
|
-
|
|
191
|
-
Start the Storybook development server
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
USAGE
|
|
195
|
-
$ create-link-app storybook [-p <value>]
|
|
196
|
-
|
|
197
|
-
FLAGS
|
|
198
|
-
-p, --port=<value> [default: 6006] Port to run the Storybook server on
|
|
199
|
-
|
|
200
|
-
DESCRIPTION
|
|
201
|
-
Start the Storybook development server
|
|
202
|
-
```
|
|
203
171
|
<!-- commandsstop -->
|
package/dist/commands/build.js
CHANGED
|
@@ -7,22 +7,12 @@ const core_1 = require("@oclif/core");
|
|
|
7
7
|
const webpack_1 = __importDefault(require("webpack"));
|
|
8
8
|
const base_1 = __importDefault(require("../base"));
|
|
9
9
|
const webpack_config_1 = __importDefault(require("../webpack/webpack.config"));
|
|
10
|
-
const child_process_1 = require("child_process");
|
|
11
10
|
class Build extends base_1.default {
|
|
12
11
|
async run() {
|
|
13
12
|
const { flags } = await this.parse(Build);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
this.webpack({
|
|
19
|
-
allowAnyOrigin: flags['allow-any-origin'],
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
async webpack(options) {
|
|
24
|
-
const config = await (0, webpack_config_1.default)('production', options);
|
|
25
|
-
(0, webpack_1.default)(config, (err, stats) => {
|
|
13
|
+
(0, webpack_1.default)((0, webpack_config_1.default)('production', {
|
|
14
|
+
allowAnyOrigin: flags['allow-any-origin'],
|
|
15
|
+
}), (err, stats) => {
|
|
26
16
|
if (err) {
|
|
27
17
|
this.error(err);
|
|
28
18
|
}
|
|
@@ -34,9 +24,6 @@ class Build extends base_1.default {
|
|
|
34
24
|
}
|
|
35
25
|
});
|
|
36
26
|
}
|
|
37
|
-
async native() {
|
|
38
|
-
(0, child_process_1.spawn)('npx react-native-builder-bob build', { cwd: process.cwd(), shell: true, stdio: 'inherit' });
|
|
39
|
-
}
|
|
40
27
|
}
|
|
41
28
|
exports.default = Build;
|
|
42
29
|
Build.description = 'Build Link App project to static assets used for production';
|
|
@@ -45,7 +32,4 @@ Build.flags = {
|
|
|
45
32
|
description: 'Allow Link App iframe to be loadable from non-Linktree origins for debugging',
|
|
46
33
|
hidden: true,
|
|
47
34
|
}),
|
|
48
|
-
native: core_1.Flags.boolean({
|
|
49
|
-
description: 'Build native components of a Link App ready for publishing to npm',
|
|
50
|
-
}),
|
|
51
35
|
};
|
package/dist/commands/dev.js
CHANGED
|
@@ -11,7 +11,6 @@ const webpack_config_1 = __importDefault(require("../webpack/webpack.config"));
|
|
|
11
11
|
class Dev extends base_1.default {
|
|
12
12
|
async run() {
|
|
13
13
|
const { flags } = await this.parse(Dev);
|
|
14
|
-
const config = await (0, webpack_config_1.default)('development');
|
|
15
14
|
const devServer = new webpack_dev_server_1.default({
|
|
16
15
|
client: {
|
|
17
16
|
overlay: false,
|
|
@@ -19,7 +18,7 @@ class Dev extends base_1.default {
|
|
|
19
18
|
hot: false,
|
|
20
19
|
https: flags.https,
|
|
21
20
|
port: flags.port,
|
|
22
|
-
}, (0, webpack_1.default)(
|
|
21
|
+
}, (0, webpack_1.default)((0, webpack_config_1.default)('development')));
|
|
23
22
|
await devServer.start();
|
|
24
23
|
}
|
|
25
24
|
}
|
|
@@ -14,10 +14,6 @@ const createProject = async (template, targetDir) => {
|
|
|
14
14
|
await fs_extra_1.default.copy(templateDir, targetDir);
|
|
15
15
|
await fs_extra_1.default.copy(templateCommonDir, targetDir);
|
|
16
16
|
await fs_extra_1.default.move(`${targetDir}/gitignore`, `${targetDir}/.gitignore`);
|
|
17
|
-
// remove types that are only required when building the `create-link-app` project
|
|
18
|
-
if (await fs_extra_1.default.existsSync(`${targetDir}/src/types/hack.d.ts`)) {
|
|
19
|
-
await fs_extra_1.default.unlink(`${targetDir}/src/types/hack.d.ts`);
|
|
20
|
-
}
|
|
21
17
|
// update `name` field in project manifest
|
|
22
18
|
const manifest = await fs_extra_1.default.readJson(`${targetDir}/manifest.json`);
|
|
23
19
|
manifest.name = (0, project_name_to_title_1.default)(path_1.default.basename(targetDir));
|
|
@@ -34,11 +34,6 @@ const OptionalAssets = [
|
|
|
34
34
|
fileName: 'url_match_rules.json',
|
|
35
35
|
contentType: 'application/json',
|
|
36
36
|
},
|
|
37
|
-
{
|
|
38
|
-
key: 'urlRules',
|
|
39
|
-
fileName: 'urlRules.json',
|
|
40
|
-
contentType: 'application/json',
|
|
41
|
-
},
|
|
42
37
|
];
|
|
43
38
|
/**
|
|
44
39
|
* Create a readable multipart/form-data stream which includes the Link App asset files.
|
|
@@ -8,13 +8,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
/**
|
|
10
10
|
* Pack the Link App source files into `package.tgz`. This includes the following:
|
|
11
|
-
* - `schema/editablePublic.jtd.json`
|
|
12
|
-
* - `schema/readonlyPublic.jtd.json`
|
|
13
|
-
* - `schema/editablePrivate.jtd.json`
|
|
14
|
-
* - `schema/readonlyPrivate.jtd.json`
|
|
15
|
-
* - `schema/system.jtd.json`
|
|
16
11
|
* - `src/`
|
|
17
|
-
* - `schema.json`
|
|
18
12
|
* - `package.json`
|
|
19
13
|
* - `package-lock.json` - *optional*
|
|
20
14
|
* - `yarn.lock` - *optional*
|
|
@@ -36,7 +30,7 @@ async function packProject() {
|
|
|
36
30
|
gzipOptions: { level: 9 },
|
|
37
31
|
});
|
|
38
32
|
archive.on('warning', (err) => {
|
|
39
|
-
if (err
|
|
33
|
+
if (err.code === 'ENOENT') {
|
|
40
34
|
// lock files and tsconfig may or may not exist
|
|
41
35
|
const fileName = path_1.default.basename(err.path);
|
|
42
36
|
if (fileName === 'package-lock.json' || fileName === 'yarn.lock' || fileName === 'tsconfig.json') {
|
|
@@ -49,11 +43,6 @@ async function packProject() {
|
|
|
49
43
|
handleFailure(err);
|
|
50
44
|
});
|
|
51
45
|
archive.pipe(outputWriteStream);
|
|
52
|
-
archive.file(resolveProjPath('schema/editablePublic.jtd.json'), { name: 'schema/editablePublic.jtd.json' });
|
|
53
|
-
archive.file(resolveProjPath('schema/readonlyPublic.jtd.json'), { name: 'schema/readonlyPublic.jtd.json' });
|
|
54
|
-
archive.file(resolveProjPath('schema/editablePrivate.jtd.json'), { name: 'schema/editablePrivate.jtd.json' });
|
|
55
|
-
archive.file(resolveProjPath('schema/readonlyPrivate.jtd.json'), { name: 'schema/readonlyPrivate.jtd.json' });
|
|
56
|
-
archive.file(resolveProjPath('schema/system.jtd.json'), { name: 'schema/system.jtd.json' });
|
|
57
46
|
archive.file(resolveProjPath('package.json'), { name: 'package.json' });
|
|
58
47
|
archive.file(resolveProjPath('package-lock.json'), { name: 'package-lock.json' });
|
|
59
48
|
archive.file(resolveProjPath('yarn.lock'), { name: 'yarn.lock' });
|
|
@@ -13,35 +13,19 @@ const path_1 = __importDefault(require("path"));
|
|
|
13
13
|
const webpack_1 = require("webpack");
|
|
14
14
|
const camelcase_1 = __importDefault(require("camelcase"));
|
|
15
15
|
const slugify_1 = __importDefault(require("slugify"));
|
|
16
|
-
const
|
|
17
|
-
const
|
|
16
|
+
const tailwindcss_1 = __importDefault(require("tailwindcss"));
|
|
17
|
+
const autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
18
18
|
const { ModuleFederationPlugin } = webpack_1.container;
|
|
19
|
-
function
|
|
20
|
-
const base64 = Buffer.from(code).toString('base64');
|
|
21
|
-
return `data:text/javascript;base64,${base64}`;
|
|
22
|
-
}
|
|
23
|
-
function hasEntrypoint(appDir, file) {
|
|
24
|
-
try {
|
|
25
|
-
fs_1.default.accessSync(path_1.default.resolve(appDir, 'src', file));
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
async function default_1(env, options) {
|
|
19
|
+
function default_1(env, options) {
|
|
33
20
|
const appDir = process.cwd();
|
|
34
21
|
const entryFile = path_1.default.resolve(__dirname, `${env}.entry`);
|
|
35
22
|
const htmlTemplateFile = path_1.default.resolve(__dirname, '..', '..', 'html-template', `${env}.html`);
|
|
36
|
-
const useAppEntry = hasEntrypoint(appDir, 'App.tsx');
|
|
37
|
-
const useSheetEntry = hasEntrypoint(appDir, 'Sheet.tsx');
|
|
38
|
-
const useEditorEntry = hasEntrypoint(appDir, 'Editor.tsx');
|
|
39
|
-
const appEntry = useAppEntry ? path_1.default.resolve(appDir, 'src/App') : path_1.default.resolve(appDir, 'src');
|
|
40
23
|
const manifestJson = JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(appDir, 'manifest.json'), 'utf8'));
|
|
41
24
|
const linkTypeName = manifestJson.name.replace(/[^A-Za-z0-9 ]/g, '');
|
|
42
25
|
const linkTypeSlug = (0, slugify_1.default)(linkTypeName, { lower: true });
|
|
43
26
|
const linkTypeId = (0, camelcase_1.default)(linkTypeSlug, { pascalCase: true });
|
|
44
27
|
const hasTsconfig = fileExists(path_1.default.resolve(appDir, 'tsconfig.json'));
|
|
28
|
+
const componentLibraryContentPath = path_1.default.join(require.resolve('@linktr.ee/component-library/tailwind.config').split('/').slice(0, -1).join('/'), 'dist', '**', '*.js');
|
|
45
29
|
const config = {
|
|
46
30
|
target: 'web',
|
|
47
31
|
mode: env,
|
|
@@ -49,9 +33,7 @@ async function default_1(env, options) {
|
|
|
49
33
|
output: {
|
|
50
34
|
publicPath: 'auto',
|
|
51
35
|
path: path_1.default.resolve(appDir, 'dist'),
|
|
52
|
-
assetModuleFilename: 'images/[hash]
|
|
53
|
-
chunkFilename: '[id].[contenthash].js',
|
|
54
|
-
filename: '[name].[contenthash].js',
|
|
36
|
+
assetModuleFilename: 'images/[hash][ext][query]',
|
|
55
37
|
},
|
|
56
38
|
module: {
|
|
57
39
|
rules: [
|
|
@@ -70,7 +52,7 @@ async function default_1(env, options) {
|
|
|
70
52
|
},
|
|
71
53
|
{
|
|
72
54
|
test: /\.(png|jpe?g|gif|svg)$/i,
|
|
73
|
-
type: 'asset/inline',
|
|
55
|
+
type: 'asset/inline',
|
|
74
56
|
},
|
|
75
57
|
{
|
|
76
58
|
test: /\.css$/,
|
|
@@ -80,7 +62,16 @@ async function default_1(env, options) {
|
|
|
80
62
|
{
|
|
81
63
|
loader: 'postcss-loader',
|
|
82
64
|
options: {
|
|
83
|
-
postcssOptions: {
|
|
65
|
+
postcssOptions: {
|
|
66
|
+
plugins: [
|
|
67
|
+
(0, tailwindcss_1.default)({
|
|
68
|
+
content: [`${appDir}/src/**/*.{js,jsx,ts,tsx}`, componentLibraryContentPath],
|
|
69
|
+
presets: [require('@linktr.ee/component-library/tailwind.config')],
|
|
70
|
+
plugins: [],
|
|
71
|
+
}),
|
|
72
|
+
(0, autoprefixer_1.default)(),
|
|
73
|
+
],
|
|
74
|
+
},
|
|
84
75
|
},
|
|
85
76
|
},
|
|
86
77
|
],
|
|
@@ -93,7 +84,7 @@ async function default_1(env, options) {
|
|
|
93
84
|
// TODO: The behaviour here with module resolution is confusing, can we make it more explicit?
|
|
94
85
|
modules: [path_1.default.resolve(appDir, 'node_modules'), 'node_modules'],
|
|
95
86
|
alias: {
|
|
96
|
-
'@linktr.ee/extension':
|
|
87
|
+
'@linktr.ee/extension': path_1.default.resolve(appDir, 'src'),
|
|
97
88
|
},
|
|
98
89
|
},
|
|
99
90
|
plugins: [
|
|
@@ -116,17 +107,6 @@ async function default_1(env, options) {
|
|
|
116
107
|
config.plugins.push(new mini_css_extract_plugin_1.default());
|
|
117
108
|
}
|
|
118
109
|
if (env === 'production') {
|
|
119
|
-
const exposedEntryPoints = {
|
|
120
|
-
// Default entry points
|
|
121
|
-
['./App']: appEntry,
|
|
122
|
-
['./validate']: toVirtualModule((await (0, compile_1.default)())),
|
|
123
|
-
};
|
|
124
|
-
if (useEditorEntry) {
|
|
125
|
-
exposedEntryPoints['./Editor'] = path_1.default.resolve(appDir, 'src/Editor');
|
|
126
|
-
}
|
|
127
|
-
if (useSheetEntry) {
|
|
128
|
-
exposedEntryPoints['./Sheet'] = path_1.default.resolve(appDir, 'src/Sheet');
|
|
129
|
-
}
|
|
130
110
|
// TODO: Figure out how to manage externals with Module Federation
|
|
131
111
|
// Possibly make the index.html a host app, via separate webpack config
|
|
132
112
|
// config.externals = {
|
|
@@ -141,8 +121,6 @@ async function default_1(env, options) {
|
|
|
141
121
|
};
|
|
142
122
|
config.plugins.push(new webpack_1.DefinePlugin({
|
|
143
123
|
__ALLOW_ANY_ORIGIN__: options?.allowAnyOrigin,
|
|
144
|
-
__LINK_TYPE_SLUG__: JSON.stringify(linkTypeSlug),
|
|
145
|
-
__LINK_TYPE_ID__: JSON.stringify(linkTypeId),
|
|
146
124
|
}),
|
|
147
125
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
148
126
|
// @ts-ignore
|
|
@@ -152,7 +130,9 @@ async function default_1(env, options) {
|
|
|
152
130
|
}), new ModuleFederationPlugin({
|
|
153
131
|
name: `LinkApp_${linkTypeId}`,
|
|
154
132
|
filename: 'remoteEntry.js',
|
|
155
|
-
exposes:
|
|
133
|
+
exposes: {
|
|
134
|
+
['./App']: path_1.default.resolve(appDir, 'src'),
|
|
135
|
+
},
|
|
156
136
|
shared: {
|
|
157
137
|
react: {
|
|
158
138
|
singleton: true,
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.0-next.
|
|
2
|
+
"version": "0.3.0-next.6",
|
|
3
3
|
"commands": {
|
|
4
4
|
"build": {
|
|
5
5
|
"id": "build",
|
|
@@ -16,12 +16,6 @@
|
|
|
16
16
|
"description": "Allow Link App iframe to be loadable from non-Linktree origins for debugging",
|
|
17
17
|
"hidden": true,
|
|
18
18
|
"allowNo": false
|
|
19
|
-
},
|
|
20
|
-
"native": {
|
|
21
|
-
"name": "native",
|
|
22
|
-
"type": "boolean",
|
|
23
|
-
"description": "Build native components of a Link App ready for publishing to npm",
|
|
24
|
-
"allowNo": false
|
|
25
19
|
}
|
|
26
20
|
},
|
|
27
21
|
"args": {}
|
|
@@ -145,17 +139,6 @@
|
|
|
145
139
|
},
|
|
146
140
|
"args": {}
|
|
147
141
|
},
|
|
148
|
-
"generate-types": {
|
|
149
|
-
"id": "generate-types",
|
|
150
|
-
"description": "Generate Typescript types from the schema definitions",
|
|
151
|
-
"strict": true,
|
|
152
|
-
"pluginName": "@linktr.ee/create-link-app",
|
|
153
|
-
"pluginAlias": "@linktr.ee/create-link-app",
|
|
154
|
-
"pluginType": "core",
|
|
155
|
-
"aliases": [],
|
|
156
|
-
"flags": {},
|
|
157
|
-
"args": {}
|
|
158
|
-
},
|
|
159
142
|
"grant-access": {
|
|
160
143
|
"id": "grant-access",
|
|
161
144
|
"description": "Grant access to other developers to push updates for your Link App",
|
|
@@ -233,26 +216,6 @@
|
|
|
233
216
|
}
|
|
234
217
|
},
|
|
235
218
|
"args": {}
|
|
236
|
-
},
|
|
237
|
-
"storybook": {
|
|
238
|
-
"id": "storybook",
|
|
239
|
-
"description": "Start the Storybook development server",
|
|
240
|
-
"strict": true,
|
|
241
|
-
"pluginName": "@linktr.ee/create-link-app",
|
|
242
|
-
"pluginAlias": "@linktr.ee/create-link-app",
|
|
243
|
-
"pluginType": "core",
|
|
244
|
-
"aliases": [],
|
|
245
|
-
"flags": {
|
|
246
|
-
"port": {
|
|
247
|
-
"name": "port",
|
|
248
|
-
"type": "option",
|
|
249
|
-
"char": "p",
|
|
250
|
-
"description": "Port to run the Storybook server on",
|
|
251
|
-
"multiple": false,
|
|
252
|
-
"default": 6006
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
"args": {}
|
|
256
219
|
}
|
|
257
220
|
}
|
|
258
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linktr.ee/create-link-app",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.6",
|
|
4
4
|
"description": "Create a Link App on Linktr.ee.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Linktree",
|
|
@@ -19,14 +19,13 @@
|
|
|
19
19
|
"/templates"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "shx rm -rf dist && tsc -b
|
|
22
|
+
"build": "shx rm -rf dist && tsc -b",
|
|
23
23
|
"postpack": "shx rm -f oclif.manifest.json",
|
|
24
24
|
"prepack": "yarn build && oclif manifest && oclif readme",
|
|
25
25
|
"test": "jest --watch",
|
|
26
26
|
"test:ci": "jest",
|
|
27
27
|
"test:cov": "jest --coverage",
|
|
28
|
-
"version": "oclif readme && git add README.md"
|
|
29
|
-
"copy-storybook-global-css": "cp ./src/storybook/global.css ./dist/storybook/global.css"
|
|
28
|
+
"version": "oclif readme && git add README.md"
|
|
30
29
|
},
|
|
31
30
|
"dependencies": {
|
|
32
31
|
"@babel/core": "^7.18.2",
|
|
@@ -35,22 +34,9 @@
|
|
|
35
34
|
"@babel/preset-react": "^7.17.12",
|
|
36
35
|
"@babel/preset-typescript": "^7.17.12",
|
|
37
36
|
"@babel/runtime": "^7.18.3",
|
|
38
|
-
"@linktr.ee/component-library": "
|
|
39
|
-
"@linktr.ee/ui-link-kit": "latest",
|
|
37
|
+
"@linktr.ee/component-library": "^7.0.17",
|
|
40
38
|
"@oclif/core": "^1.9.0",
|
|
41
|
-
"@oclif/plugin-help": "5.1.
|
|
42
|
-
"@storybook/addon-actions": "^6.5.9",
|
|
43
|
-
"@storybook/addon-essentials": "^6.5.9",
|
|
44
|
-
"@storybook/addon-interactions": "^6.5.9",
|
|
45
|
-
"@storybook/addon-links": "^6.5.9",
|
|
46
|
-
"@storybook/addon-postcss": "^2.0.0",
|
|
47
|
-
"@storybook/builder-webpack5": "^6.5.9",
|
|
48
|
-
"@storybook/manager-webpack5": "^6.5.9",
|
|
49
|
-
"@storybook/react": "^6.5.9",
|
|
50
|
-
"@tailwindcss/line-clamp": "^0.4.4",
|
|
51
|
-
"@testing-library/react": "^12.1.4",
|
|
52
|
-
"@testing-library/user-event": "14",
|
|
53
|
-
"ajv": "^8.12.0",
|
|
39
|
+
"@oclif/plugin-help": "^5.1.12",
|
|
54
40
|
"archiver": "^5.3.1",
|
|
55
41
|
"autoprefixer": "^10.4.14",
|
|
56
42
|
"axios": "^0.27.2",
|
|
@@ -68,18 +54,12 @@
|
|
|
68
54
|
"openid-client": "^5.1.6",
|
|
69
55
|
"postcss": "^8.4.21",
|
|
70
56
|
"postcss-loader": "^4.3.0",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"react": "^18.2.0",
|
|
74
|
-
"react-dom": "^18.2.0",
|
|
75
|
-
"react-native-builder-bob": "^0.21.3",
|
|
57
|
+
"react": "^17.0.2",
|
|
58
|
+
"react-dom": "^17.0.2",
|
|
76
59
|
"slugify": "^1.6.6",
|
|
77
|
-
"storybook-addon-designs": "^6.3.1",
|
|
78
|
-
"storybook-addon-turbo-build": "^1.1.0",
|
|
79
60
|
"style-loader": "^3.3.2",
|
|
80
61
|
"styled-components": "^5.3.5",
|
|
81
|
-
"tailwindcss": "^3.3.
|
|
82
|
-
"ts-loader": "^9.4.4",
|
|
62
|
+
"tailwindcss": "^3.3.1",
|
|
83
63
|
"typescript": "^4.7.3",
|
|
84
64
|
"webpack": "^5.75.0",
|
|
85
65
|
"webpack-dev-server": "^4.11.1"
|
|
@@ -92,8 +72,8 @@
|
|
|
92
72
|
"@types/fs-extra": "^9.0.13",
|
|
93
73
|
"@types/jest": "^28.1.1",
|
|
94
74
|
"@types/jsonwebtoken": "^8.5.8",
|
|
95
|
-
"@types/react": "^
|
|
96
|
-
"@types/react-dom": "^
|
|
75
|
+
"@types/react": "^17.0.45",
|
|
76
|
+
"@types/react-dom": "^17.0.17",
|
|
97
77
|
"axios-mock-adapter": "^1.21.1",
|
|
98
78
|
"jest": "^28.1.1",
|
|
99
79
|
"oclif": "^3.0.1",
|
|
@@ -14,34 +14,13 @@ Optionally, you can specify a different port or serve over HTTPS. Run command wi
|
|
|
14
14
|
|
|
15
15
|
Several files were created during the bootstrapping of this project. Some of these files play a key role:
|
|
16
16
|
|
|
17
|
-
| File
|
|
18
|
-
|
|
|
19
|
-
| `src/index.jsx`
|
|
20
|
-
| `manifest.json`
|
|
21
|
-
| `settings.json`
|
|
22
|
-
| `fixtures/props-data.json` | Used during development, this file acts as mock data for the `settings.json` output, it is injected as props to the entry point component
|
|
23
|
-
| `url-match-rules.json`
|
|
24
|
-
| `schema/*.jtd.json` | These files define the shape of the data that is stored for each Link that uses this Link App. They are used to validate the data on the front and back end and to generate Typescript types shared between client and server. The format for these schemas adheres to the [JSON Type Definition](https://jsontypedef.com/), aka [RFC 8927](https://datatracker.ietf.org/doc/html/rfc8927), standard. |
|
|
25
|
-
|
|
26
|
-
## Generating types from your `schema/*.jtd.json` files
|
|
27
|
-
|
|
28
|
-
Under the hood Linktree uses the `jtd-codegen` package to generate types from your schema. If you want to generate types for local development, this package must first be installed on your system. You can install it with the following command:
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
brew install jsontypedef/jsontypedef/jtd-codegen
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
You will also require `prettier`
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
brew install prettier
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
When you have these packages installed, you can generate types by running one of the following commands:
|
|
41
|
-
|
|
42
|
-
`npm run generate:types` or `yarn generate:types`
|
|
43
|
-
|
|
44
|
-
For more information on using `jtd-codegen` to generate code see the [official documentation](https://jsontypedef.com/docs/jtd-codegen/), or for specifics on generating Typescript code [here](https://jsontypedef.com/docs/typescript-codegen/).
|
|
17
|
+
| File | Description |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| `src/index.jsx` | The entry point for your Link App |
|
|
20
|
+
| `manifest.json` | Defines key information about your Link App, and helps users to discover your Link App via the [Linktree Marketplace](https://linktr.ee/marketplace) |
|
|
21
|
+
| `settings.json` | Defines the settings made available to Linktree users when configuring the Link App via [Linktree Admin](https://linktr.ee/admin) |
|
|
22
|
+
| `fixtures/props-data.json` | Used during development, this file acts as mock data for the `settings.json` output, it is injected as props to the entry point component |
|
|
23
|
+
| `url-match-rules.json` | Defines the URL pattern to match against when users add a link on Linktree via URL, its structure follows the [URL Pattern API](https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API) |
|
|
45
24
|
|
|
46
25
|
## UI Components
|
|
47
26
|
|
|
@@ -93,18 +72,18 @@ Access to a Link App can be granted to additional users who may need to retrieve
|
|
|
93
72
|
|
|
94
73
|
Please note the user receiving access must also have a Linktree account with developer privileges. Maintainer access can be granted to as many developer accounts as required.
|
|
95
74
|
|
|
96
|
-
|
|
75
|
+
***Note: Only the Link App Owner can grant Maintainer access to additional users. You must be logged in with an Owner account in order to use the command.***
|
|
97
76
|
|
|
98
77
|
### Maintainer and Owner Permitted Actions
|
|
99
78
|
|
|
100
79
|
The following table compares which actions are permitted for Maintainers and Owners:
|
|
101
80
|
|
|
102
|
-
|
|
|
103
|
-
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
81
|
+
|Action |Owner |Maintainer|Notes |
|
|
82
|
+
|---------------------------|-------|----------|-----------------------------------------------|
|
|
83
|
+
|Create Link App |✓|N/A |Owner is defined when Link App is first created|
|
|
84
|
+
|Get Link App |✓|✓ | |
|
|
85
|
+
|Update Link App |✓|✓ | |
|
|
86
|
+
|Request Link App review |✓|✓ | |
|
|
87
|
+
|Get Link App maintainers |✓|✓ | |
|
|
88
|
+
|Add new Link App maintainer|✓|✗ | |
|
|
89
|
+
|Remove Link App maintainer |✓|✗ | |
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
"title": "Link
|
|
2
|
+
"title": "Link Type",
|
|
3
|
+
"overview": {
|
|
4
|
+
"title": "You can have a heading",
|
|
5
|
+
"description": "as well as a description to inform users on what the link does."
|
|
6
|
+
},
|
|
3
7
|
"elements": [
|
|
4
8
|
{
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
+
"inputType": "linkBehavior",
|
|
10
|
+
"id": "how_link_behaves",
|
|
11
|
+
"title": "How would you like the link to behave?",
|
|
12
|
+
"description": "When a user interacts with this link:",
|
|
13
|
+
"linkBehaviorLabels": {
|
|
14
|
+
"embedLabel": "Embed content on the profile",
|
|
15
|
+
"linkOffLabel": "Go directly to URL"
|
|
16
|
+
},
|
|
17
|
+
"defaultValue": "embedLabel"
|
|
9
18
|
},
|
|
10
19
|
{
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
20
|
+
"inputType": "switch",
|
|
21
|
+
"id": "toggle",
|
|
22
|
+
"title": "Use another title/description to break up content",
|
|
23
|
+
"description": "and describe what the next section of inputs will do",
|
|
24
|
+
"label": "Is feature enabled?",
|
|
25
|
+
"defaultValue": true
|
|
14
26
|
},
|
|
15
27
|
{
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
28
|
+
"inputType": "text",
|
|
29
|
+
"id": "your_name",
|
|
30
|
+
"label": "elements that only have a label will stick close the element above"
|
|
19
31
|
}
|
|
20
32
|
]
|
|
21
33
|
}
|
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
"scripts": {
|
|
4
4
|
"build": "create-link-app build",
|
|
5
5
|
"deploy": "create-link-app deploy",
|
|
6
|
-
"
|
|
7
|
-
"dev": "create-link-app dev",
|
|
8
|
-
"generate:types": "jtd-codegen ./schema.json --typescript-out src/types --root-name=LinkAppData"
|
|
6
|
+
"dev": "create-link-app dev"
|
|
9
7
|
},
|
|
10
8
|
"devDependencies": {
|
|
11
|
-
"@linktr.ee/
|
|
12
|
-
"@linktr.ee/create-link-app": "next",
|
|
9
|
+
"@linktr.ee/create-link-app": "latest",
|
|
13
10
|
"@linktr.ee/ui-link-kit": "latest"
|
|
14
11
|
}
|
|
15
12
|
}
|
|
Binary file
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Container, Description, Header } from '@linktr.ee/ui-link-kit'
|
|
2
2
|
|
|
3
|
-
import './
|
|
3
|
+
import logo from './images/logo.png'
|
|
4
4
|
|
|
5
|
-
function App({
|
|
6
|
-
return
|
|
5
|
+
function App({ toggle, your_name, __linkUrl }) {
|
|
6
|
+
return (
|
|
7
|
+
<Container
|
|
8
|
+
primaryCta={toggle ? { label: 'Visit our UI docs for more info', href: 'https://blstrco.github.io/ui-link-kit/' } : null}
|
|
9
|
+
secondaryCta={toggle ? { label: 'Original url for your Linktree link', href: __linkUrl } : null}
|
|
10
|
+
logo={logo}
|
|
11
|
+
>
|
|
12
|
+
<Header heading={`Hello ${your_name}!`} secondaryHeading="Congratulations, you now have a Linktree link!" layout="hero" />
|
|
13
|
+
<Description>{your_name}</Description>
|
|
14
|
+
</Container>
|
|
15
|
+
)
|
|
7
16
|
}
|
|
8
17
|
|
|
9
18
|
export default App
|