Skip to content

Conversation

@iowillhoit
Copy link
Contributor

@iowillhoit iowillhoit commented Mar 13, 2024

TODO: Remove branch reference

What does this PR do?

Hides the dev generate library command. Intended for internal use, externals could use it with some changes.
Replaces the message import in the template forcedotcom/library-template#8

Testing

  • Clone branch
  • yarn build
  • cd ..
  • Run ./plugin-dev/bin/run.js dev generate library
  • Inspect the created library
    • Will be in a directory matching the Name you provide.
    • Run yarn build
    • Run yarn test
      • Note, link-checker might fail since this is not Open Source yet. Running CI=1 yarn test will skip link-check
    • Test in node repl
node
# enters repl
const { Hello } = require('./lib/index.js'); 
const hello = new Hello();
hello.greet('Codey');
# Prints 'Hello, Codey'

What issues does this PR fix or reference?

@W-15235736@


const directory = path.resolve(this.answers.name);
shelljs.exec(`git clone git@github.com:forcedotcom/library-template.git ${directory}`);
shelljs.exec(`git clone -b ew/update-template git@github.com:forcedotcom/library-template.git ${directory}`);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove branch ref before merging

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idea: make the branch an env var and/or flag for scenarios like this where we want to test the generator against a different branch

@mdonnalley
Copy link
Collaborator

QA
Setup: checkout, yarn && yarn build, sf plugins link --no-install

sf dev generate library

  • accept default @salesforce
  • accept default forcedotcom
Time to build a library!
? Npm Scope (should start with @) @salesforce
? Name qa-library
? Description a library for qa
? Github Org forcedotcom

🟢 Generates library
🟢 yarn build
🟢 yarn test (fails with link checks as expected)
🟢 can run in node repl

node
# enters repl
const { Hello } = require('./lib/index.js'); 
const hello = new Hello();
hello.greet('Codey');
# Prints 'Hello, Codey'

🟢 can yarn link to another library

yarn link
cd another-lib
yarn link @salesforce/qa-library

in index.js

const {Hello} = require('@salesforce/qa-library');
const hello = new Hello()
console.log(hello.greet('Codey'))
❯ node index.js
Hello, Codey

@iowillhoit iowillhoit marked this pull request as ready for review March 15, 2024 19:12
@iowillhoit iowillhoit merged commit 8391dab into main Mar 15, 2024
@iowillhoit iowillhoit deleted the ew/generate-lib-updates branch March 15, 2024 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants