@linktr.ee/create-link-app 0.1.0 → 0.2.1

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 CHANGED
@@ -24,7 +24,7 @@ yarn create @linktr.ee/create-link-app my-link-app
24
24
  * [`create-link-app deploy`](#create-link-app-deploy)
25
25
  * [`create-link-app dev`](#create-link-app-dev)
26
26
  * [`create-link-app grant-access LINK_APP_ID USERNAME`](#create-link-app-grant-access-link_app_id-username)
27
- * [`create-link-app help [COMMAND]`](#create-link-app-help-command)
27
+ * [`create-link-app help [COMMANDS]`](#create-link-app-help-commands)
28
28
  * [`create-link-app login`](#create-link-app-login)
29
29
  * [`create-link-app logout`](#create-link-app-logout)
30
30
 
@@ -46,7 +46,7 @@ Initialize a new Link App project
46
46
 
47
47
  ```
48
48
  USAGE
49
- $ create-link-app create [NAME] [-t react|react-ts] [-p <value>]
49
+ $ create-link-app create NAME [-t react|react-ts] [-p <value>]
50
50
 
51
51
  ARGUMENTS
52
52
  NAME Name of the Link App
@@ -112,7 +112,7 @@ Grant access to other developers to push updates for your Link App
112
112
 
113
113
  ```
114
114
  USAGE
115
- $ create-link-app grant-access [LINK_APP_ID] [USERNAME]
115
+ $ create-link-app grant-access LINK_APP_ID USERNAME
116
116
 
117
117
  ARGUMENTS
118
118
  LINK_APP_ID The Link App's ID you wish to grant access to
@@ -125,16 +125,16 @@ EXAMPLES
125
125
  $ create-link-app grant-access my-link-app friend
126
126
  ```
127
127
 
128
- ## `create-link-app help [COMMAND]`
128
+ ## `create-link-app help [COMMANDS]`
129
129
 
130
130
  Display help for create-link-app.
131
131
 
132
132
  ```
133
133
  USAGE
134
- $ create-link-app help [COMMAND] [-n]
134
+ $ create-link-app help [COMMANDS] [-n]
135
135
 
136
136
  ARGUMENTS
137
- COMMAND Command to show help for.
137
+ COMMANDS Command to show help for.
138
138
 
139
139
  FLAGS
140
140
  -n, --nested-commands Include all nested commands in the output.
@@ -143,7 +143,7 @@ DESCRIPTION
143
143
  Display help for create-link-app.
144
144
  ```
145
145
 
146
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.12/src/commands/help.ts)_
146
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.9/src/commands/help.ts)_
147
147
 
148
148
  ## `create-link-app login`
149
149
 
@@ -17,7 +17,7 @@ class Deploy extends base_1.default {
17
17
  const accessToken = (0, access_token_1.getAccessToken)(appConfig.auth.audience);
18
18
  await (0, pack_project_1.default)();
19
19
  const form = (0, create_form_data_1.default)(flags.path);
20
- const url = flags.endpoint ?? appConfig.linkTypesUrl;
20
+ const url = `${flags.endpoint ?? appConfig.link_types_url}/link-types`;
21
21
  try {
22
22
  const result = await (0, upload_assets_1.default)(url, form, accessToken, flags.update, flags['force-update']);
23
23
  this.log(`Draft Link App successfully ${flags.update ? 'updated' : 'uploaded'}\n`);
@@ -12,7 +12,7 @@ class GrantAccess extends base_1.default {
12
12
  const { args, flags } = await this.parse(GrantAccess);
13
13
  const appConfig = await this.getAppConfig(flags.qa ? 'qa' : 'production');
14
14
  const accessToken = (0, access_token_1.getAccessToken)(appConfig.auth.audience);
15
- const url = `${flags.endpoint ?? appConfig.linkTypesUrl}/${args.link_app_id}/maintainers`;
15
+ const url = `${flags.endpoint ?? appConfig.link_types_url}/link-types/${args.link_app_id}/maintainers`;
16
16
  const maintainerDto = {
17
17
  username: args.username,
18
18
  is_owner: false,
@@ -10,11 +10,11 @@ class Logout extends base_1.default {
10
10
  async run() {
11
11
  const { flags } = await this.parse(Logout);
12
12
  const appConfig = await this.getAppConfig(flags.qa ? 'qa' : 'production');
13
- const { auth, logoutUrl } = appConfig;
13
+ const { auth, logout_redirect_url } = appConfig;
14
14
  const { domain, client_id, audience } = auth;
15
15
  (0, access_token_1.removeAccessToken)(audience);
16
16
  // clear Auth0 session cookies so user gets prompted to enter credentials again for next login
17
- const url = `${domain}/v2/logout?client_id=${client_id}&returnTo=${logoutUrl}`;
17
+ const url = `${domain}/v2/logout?client_id=${client_id}&returnTo=${logout_redirect_url}`;
18
18
  core_1.CliUx.ux.open(url);
19
19
  this.log('Logout successful.');
20
20
  this.log(`If browser did not open automatically, please go to the following link to logout from the browser: ${url}`);
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_extra_1 = __importDefault(require("fs-extra"));
7
7
  const path_1 = __importDefault(require("path"));
8
+ const project_name_to_title_1 = __importDefault(require("./project-name-to-title"));
8
9
  // templates path relative to this module
9
10
  const BaseTemplatesDir = path_1.default.resolve(__dirname, '..', '..', '..', 'templates');
10
11
  const createProject = async (template, targetDir) => {
@@ -13,5 +14,9 @@ const createProject = async (template, targetDir) => {
13
14
  await fs_extra_1.default.copy(templateDir, targetDir);
14
15
  await fs_extra_1.default.copy(templateCommonDir, targetDir);
15
16
  await fs_extra_1.default.move(`${targetDir}/gitignore`, `${targetDir}/.gitignore`);
17
+ // update `name` field in project manifest
18
+ const manifest = await fs_extra_1.default.readJson(`${targetDir}/manifest.json`);
19
+ manifest.name = (0, project_name_to_title_1.default)(path_1.default.basename(targetDir));
20
+ await fs_extra_1.default.writeJson(`${targetDir}/manifest.json`, manifest, { spaces: 2 });
16
21
  };
17
22
  exports.default = createProject;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * Transforms hyphen or underscore separated name to title, e.g. 'cool-link' to 'Cool Link'.
5
+ */
6
+ const projectNameToTitle = (name) => {
7
+ const words = name.split(/[-_]/);
8
+ const title = words.map((word) => `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`);
9
+ return title.join(' ');
10
+ };
11
+ exports.default = projectNameToTitle;
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const axios_1 = __importDefault(require("axios"));
7
7
  const fetchAppConfig = async (stage = 'production') => {
8
- const configUrl = `https://link-types-assets.${stage}.linktr.ee/application-config/create-link-cli.json`;
8
+ const configUrl = `https://link-types-config.${stage}.linktr.ee/create-link-app.json`;
9
9
  try {
10
10
  const response = await axios_1.default.get(configUrl);
11
11
  return response.data;
@@ -22,7 +22,9 @@ function default_1(env, options) {
22
22
  output: {
23
23
  publicPath: '',
24
24
  path: path_1.default.resolve(appDir, 'dist'),
25
- assetModuleFilename: 'images/[hash][ext][query]',
25
+ assetModuleFilename: 'images/[hash].[contenthash][ext][query]',
26
+ chunkFilename: '[id].[contenthash].js',
27
+ filename: '[name].[contenthash].js',
26
28
  },
27
29
  module: {
28
30
  rules: [
@@ -40,8 +42,8 @@ function default_1(env, options) {
40
42
  },
41
43
  },
42
44
  {
43
- test: /\.(png|jpe?g|gif)$/i,
44
- type: 'asset/resource',
45
+ test: /\.(png|jpe?g|gif|svg)$/i,
46
+ type: 'asset/inline', // <-- this builds all images into data URLs, is that what you want?
45
47
  },
46
48
  ],
47
49
  },
@@ -1 +1,221 @@
1
- {"version":"0.1.0","commands":{"build":{"id":"build","description":"Build Link App project to static assets used for production","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"flags":{"allow-any-origin":{"name":"allow-any-origin","type":"boolean","description":"Allow Link App iframe to be loadable from non-Linktree origins for debugging","hidden":true,"allowNo":false}},"args":[],"_globalFlags":{}},"create":{"id":"create","description":"Initialize a new Link App project","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"examples":["$ create-link-app create my-link-app","$ create-link-app create my-link-app --template react","$ create-link-app create my-link-app --path my/custom/path"],"flags":{"template":{"name":"template","type":"option","char":"t","description":"Template to use for the project","multiple":false,"options":["react","react-ts"],"default":"react-ts"},"path":{"name":"path","type":"option","char":"p","description":"Path to create the project in","multiple":false}},"args":[{"name":"name","description":"Name of the Link App","required":true}],"_globalFlags":{}},"deploy":{"id":"deploy","description":"Deploy your Link App and test it on Linktr.ee","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"flags":{"path":{"name":"path","type":"option","char":"p","description":"Specify custom path to project directory","multiple":false},"update":{"name":"update","type":"boolean","description":"Push update for existing Link App","allowNo":false},"endpoint":{"name":"endpoint","type":"option","description":"Custom API endpoint to push assets to","hidden":true,"multiple":false},"qa":{"name":"qa","type":"boolean","description":"Use QA environment","hidden":true,"allowNo":false},"force-update":{"name":"force-update","type":"boolean","description":"Allow Link Type Admins to push updates to Link Apps in PUBLISHED state","hidden":true,"allowNo":false}},"args":[],"_globalFlags":{}},"dev":{"id":"dev","description":"Start development server for Link App project","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"examples":["$ create-link-app dev","$ create-link-app dev --port 8000","$ create-link-app dev --https"],"flags":{"port":{"name":"port","type":"option","char":"p","description":"Development server listening port","multiple":false,"default":3000},"https":{"name":"https","type":"boolean","description":"Use HTTPS for development server","allowNo":false}},"args":[],"_globalFlags":{}},"grant-access":{"id":"grant-access","description":"Grant access to other developers to push updates for your Link App","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"examples":["$ create-link-app grant-access my-link-app friend"],"flags":{"endpoint":{"name":"endpoint","type":"option","description":"Custom API endpoint to push assets to","hidden":true,"multiple":false},"qa":{"name":"qa","type":"boolean","description":"Use QA environment","hidden":true,"allowNo":false}},"args":[{"name":"link_app_id","description":"The Link App's ID you wish to grant access to","required":true},{"name":"username","description":"The Linktree username of the developer you wish to grant access to","required":true}],"_globalFlags":{}},"login":{"id":"login","description":"Login using your Linktree credentials to deploy Link Apps","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"flags":{"qa":{"name":"qa","type":"boolean","description":"Use QA environment","hidden":true,"allowNo":false}},"args":[],"_globalFlags":{}},"logout":{"id":"logout","description":"Logout and clear browser session","strict":true,"pluginName":"@linktr.ee/create-link-app","pluginAlias":"@linktr.ee/create-link-app","pluginType":"core","aliases":[],"flags":{"qa":{"name":"qa","type":"boolean","description":"Use QA environment","hidden":true,"allowNo":false}},"args":[],"_globalFlags":{}}}}
1
+ {
2
+ "version": "0.2.1",
3
+ "commands": {
4
+ "build": {
5
+ "id": "build",
6
+ "description": "Build Link App project to static assets used for production",
7
+ "strict": true,
8
+ "pluginName": "@linktr.ee/create-link-app",
9
+ "pluginAlias": "@linktr.ee/create-link-app",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "flags": {
13
+ "allow-any-origin": {
14
+ "name": "allow-any-origin",
15
+ "type": "boolean",
16
+ "description": "Allow Link App iframe to be loadable from non-Linktree origins for debugging",
17
+ "hidden": true,
18
+ "allowNo": false
19
+ }
20
+ },
21
+ "args": {}
22
+ },
23
+ "create": {
24
+ "id": "create",
25
+ "description": "Initialize a new Link App project",
26
+ "strict": true,
27
+ "pluginName": "@linktr.ee/create-link-app",
28
+ "pluginAlias": "@linktr.ee/create-link-app",
29
+ "pluginType": "core",
30
+ "aliases": [],
31
+ "examples": [
32
+ "$ create-link-app create my-link-app",
33
+ "$ create-link-app create my-link-app --template react",
34
+ "$ create-link-app create my-link-app --path my/custom/path"
35
+ ],
36
+ "flags": {
37
+ "template": {
38
+ "name": "template",
39
+ "type": "option",
40
+ "char": "t",
41
+ "description": "Template to use for the project",
42
+ "multiple": false,
43
+ "options": [
44
+ "react",
45
+ "react-ts"
46
+ ],
47
+ "default": "react-ts"
48
+ },
49
+ "path": {
50
+ "name": "path",
51
+ "type": "option",
52
+ "char": "p",
53
+ "description": "Path to create the project in",
54
+ "multiple": false
55
+ }
56
+ },
57
+ "args": {
58
+ "name": {
59
+ "name": "name",
60
+ "description": "Name of the Link App",
61
+ "required": true
62
+ }
63
+ }
64
+ },
65
+ "deploy": {
66
+ "id": "deploy",
67
+ "description": "Deploy your Link App and test it on Linktr.ee",
68
+ "strict": true,
69
+ "pluginName": "@linktr.ee/create-link-app",
70
+ "pluginAlias": "@linktr.ee/create-link-app",
71
+ "pluginType": "core",
72
+ "aliases": [],
73
+ "flags": {
74
+ "path": {
75
+ "name": "path",
76
+ "type": "option",
77
+ "char": "p",
78
+ "description": "Specify custom path to project directory",
79
+ "multiple": false
80
+ },
81
+ "update": {
82
+ "name": "update",
83
+ "type": "boolean",
84
+ "description": "Push update for existing Link App",
85
+ "allowNo": false
86
+ },
87
+ "endpoint": {
88
+ "name": "endpoint",
89
+ "type": "option",
90
+ "description": "Custom API endpoint to push assets to",
91
+ "hidden": true,
92
+ "multiple": false
93
+ },
94
+ "qa": {
95
+ "name": "qa",
96
+ "type": "boolean",
97
+ "description": "Use QA environment",
98
+ "hidden": true,
99
+ "allowNo": false
100
+ },
101
+ "force-update": {
102
+ "name": "force-update",
103
+ "type": "boolean",
104
+ "description": "Allow Link Type Admins to push updates to Link Apps in PUBLISHED state",
105
+ "hidden": true,
106
+ "allowNo": false
107
+ }
108
+ },
109
+ "args": {}
110
+ },
111
+ "dev": {
112
+ "id": "dev",
113
+ "description": "Start development server for Link App project",
114
+ "strict": true,
115
+ "pluginName": "@linktr.ee/create-link-app",
116
+ "pluginAlias": "@linktr.ee/create-link-app",
117
+ "pluginType": "core",
118
+ "aliases": [],
119
+ "examples": [
120
+ "$ create-link-app dev",
121
+ "$ create-link-app dev --port 8000",
122
+ "$ create-link-app dev --https"
123
+ ],
124
+ "flags": {
125
+ "port": {
126
+ "name": "port",
127
+ "type": "option",
128
+ "char": "p",
129
+ "description": "Development server listening port",
130
+ "multiple": false,
131
+ "default": 3000
132
+ },
133
+ "https": {
134
+ "name": "https",
135
+ "type": "boolean",
136
+ "description": "Use HTTPS for development server",
137
+ "allowNo": false
138
+ }
139
+ },
140
+ "args": {}
141
+ },
142
+ "grant-access": {
143
+ "id": "grant-access",
144
+ "description": "Grant access to other developers to push updates for your Link App",
145
+ "strict": true,
146
+ "pluginName": "@linktr.ee/create-link-app",
147
+ "pluginAlias": "@linktr.ee/create-link-app",
148
+ "pluginType": "core",
149
+ "aliases": [],
150
+ "examples": [
151
+ "$ create-link-app grant-access my-link-app friend"
152
+ ],
153
+ "flags": {
154
+ "endpoint": {
155
+ "name": "endpoint",
156
+ "type": "option",
157
+ "description": "Custom API endpoint to push assets to",
158
+ "hidden": true,
159
+ "multiple": false
160
+ },
161
+ "qa": {
162
+ "name": "qa",
163
+ "type": "boolean",
164
+ "description": "Use QA environment",
165
+ "hidden": true,
166
+ "allowNo": false
167
+ }
168
+ },
169
+ "args": {
170
+ "link_app_id": {
171
+ "name": "link_app_id",
172
+ "description": "The Link App's ID you wish to grant access to",
173
+ "required": true
174
+ },
175
+ "username": {
176
+ "name": "username",
177
+ "description": "The Linktree username of the developer you wish to grant access to",
178
+ "required": true
179
+ }
180
+ }
181
+ },
182
+ "login": {
183
+ "id": "login",
184
+ "description": "Login using your Linktree credentials to deploy Link Apps",
185
+ "strict": true,
186
+ "pluginName": "@linktr.ee/create-link-app",
187
+ "pluginAlias": "@linktr.ee/create-link-app",
188
+ "pluginType": "core",
189
+ "aliases": [],
190
+ "flags": {
191
+ "qa": {
192
+ "name": "qa",
193
+ "type": "boolean",
194
+ "description": "Use QA environment",
195
+ "hidden": true,
196
+ "allowNo": false
197
+ }
198
+ },
199
+ "args": {}
200
+ },
201
+ "logout": {
202
+ "id": "logout",
203
+ "description": "Logout and clear browser session",
204
+ "strict": true,
205
+ "pluginName": "@linktr.ee/create-link-app",
206
+ "pluginAlias": "@linktr.ee/create-link-app",
207
+ "pluginType": "core",
208
+ "aliases": [],
209
+ "flags": {
210
+ "qa": {
211
+ "name": "qa",
212
+ "type": "boolean",
213
+ "description": "Use QA environment",
214
+ "hidden": true,
215
+ "allowNo": false
216
+ }
217
+ },
218
+ "args": {}
219
+ }
220
+ }
221
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linktr.ee/create-link-app",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Create a Link App on Linktr.ee.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Linktree",
@@ -51,8 +51,8 @@
51
51
  "react-dom": "^17.0.2",
52
52
  "styled-components": "^5.3.5",
53
53
  "typescript": "^4.7.3",
54
- "webpack": "^5.73.0",
55
- "webpack-dev-server": "^4.9.2"
54
+ "webpack": "^5.75.0",
55
+ "webpack-dev-server": "^4.11.1"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@oclif/test": "^2.1.0",
@@ -1,17 +1,17 @@
1
- import React from 'react'
2
- import { Contact } from '@linktr.ee/ui-link-kit'
1
+ import { Container, Description, Header } from '@linktr.ee/ui-link-kit'
2
+
3
+ import logo from './images/logo.png'
3
4
 
4
5
  function App({ toggle, your_name, __linkUrl }) {
5
6
  return (
6
- <Contact
7
- loading={false}
8
- heading={`Hello ${your_name}!`}
9
- secondaryHeading="Congratulations, you now have a Linktree link!"
10
- content=""
7
+ <Container
11
8
  primaryCta={toggle ? { label: 'Visit our UI docs for more info', href: 'https://blstrco.github.io/ui-link-kit/' } : null}
12
9
  secondaryCta={toggle ? { label: 'Original url for your Linktree link', href: __linkUrl } : null}
13
- logo=""
14
- />
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
15
  )
16
16
  }
17
17
 
@@ -10,7 +10,7 @@ function App({ toggle, your_name, __linkUrl }: SettingsData) {
10
10
  secondaryCta={toggle ? { label: 'Original url for your Linktree link', href: __linkUrl } : null}
11
11
  logo={logo}
12
12
  >
13
- <Header heading={`Hello ${your_name}!`} secondaryHeading="Congratulations, you now have a Linktree link!" layout="banner" />
13
+ <Header heading={`Hello ${your_name}!`} secondaryHeading="Congratulations, you now have a Linktree link!" layout="hero" />
14
14
  <Description>{your_name}</Description>
15
15
  </Container>
16
16
  )
@@ -2,3 +2,4 @@ declare module '*.jpg'
2
2
  declare module '*.png'
3
3
  declare module '*.jpeg'
4
4
  declare module '*.gif'
5
+ declare module '*.svg'