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

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.
@@ -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;
@@ -40,8 +40,8 @@ function default_1(env, options) {
40
40
  },
41
41
  },
42
42
  {
43
- test: /\.(png|jpe?g|gif)$/i,
44
- type: 'asset/resource',
43
+ test: /\.(png|jpe?g|gif|svg)$/i,
44
+ type: 'asset/inline',
45
45
  },
46
46
  ],
47
47
  },
@@ -1 +1 @@
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
+ {"version":"0.2.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":{}}}}
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.0",
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'